Skip to content

Allow <includePluginDependencies> to be specified for the exec:exec goal - #186

Closed
adamretter wants to merge 1 commit into
mojohaus:masterfrom
adamretter:exec-exec-includePluginDependencies
Closed

adamretter wants to merge 1 commit into
mojohaus:masterfrom
adamretter:exec-exec-includePluginDependencies

Conversation

@adamretter

@adamretter adamretter commented Dec 1, 2020 •

Copy link
Copy Markdown
Contributor

This allows Java tools which are external to the dependencies of the project itself to be run using exec:exec.

For example, if I want to run The JAXB compiler xjc during the build process, I don't need it as an actual dependency of my project at runtime, but I do need it as a dependency of the exec plugin.

For example:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>3.0.1-SNAPSHOT</version>
    <executions>
        <execution>
            <id>generate-jaxb-classes</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <includePluginDependencies>true</includePluginDependencies>
                <executable>java</executable>
                <arguments>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>com.sun.tools.xjc.XJCFacade</argument>
                    <argument>-verbose</argument>
                    <argument>-d</argument>
                    <argument>${project.build.directory}/generated-sources/jaxb</argument>
                    <argument>-b</argument>
                    <argument>${project.basedir}/src/main/xjb</argument>
                    <argument>${project.basedir}/src/main/xsd</argument>
                </arguments>
            </configuration>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-xjc</artifactId>
            <version>3.0.0</version>
        </dependency>
    </dependencies>
</plugin>

Before this PR the above configuration would fail with:

Error: Could not find or load main class com.sun.tools.xjc.XJCFacade

[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:1002)
...

@adamretter
adamretter force-pushed the exec-exec-includePluginDependencies branch 2 times, most recently from c3769a7 to 8dc292a Compare December 2, 2020 13:35
@adamretter
adamretter force-pushed the exec-exec-includePluginDependencies branch from 8dc292a to c76ebb9 Compare December 2, 2020 19:52
@adamretter

Copy link
Copy Markdown
Contributor Author

@olamy @khmarbaise Any chance of getting some review on this? I included all the good stuff (tests, passing CI) ;-)

@dizzzz

dizzzz commented Dec 9, 2020

Copy link
Copy Markdown

Good stuff @adamretter , very useful

@adamretter

Copy link
Copy Markdown
Contributor Author

@olamy @khmarbaise Just a gentle ping to see if there is any chance of getting this merged?

@olamy olamy added the enhancement New feature or request label Jul 12, 2022
@olamy

olamy commented Jul 12, 2022

Copy link
Copy Markdown
Member

sounds very useful. would you mind resolve conflicts?

@slawekjaranowski

Copy link
Copy Markdown
Member

suppressed by #432

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants