Giter VIP home page Giter VIP logo

exec-maven-plugin's Introduction

MojoHaus Exec Maven Plugin

This is the exec-maven-plugin.

Apache License, Version 2.0, January 2004 Maven Central GitHub CI

Releasing

  • Make sure gpg-agent is running.
  • Execute mvn -B release:prepare release:perform

For publishing the site do the following:

cd target/checkout
mvn verify site site:stage scm-publish:publish-scm

exec-maven-plugin's People

Contributors

alanunderwood avatar andham avatar bentmann avatar bmarwell avatar brettporter avatar brianf avatar codetriage-readme-bot avatar danielsuo avatar dantran avatar dennisl avatar dependabot[bot] avatar hankolerd avatar hboutemy avatar jan-feindt avatar jmcc0nn3ll avatar khmarbaise avatar kriegaex avatar krosenvold avatar lacostej avatar mkarg avatar mkleint avatar ninthnails avatar oching avatar olamy avatar pzygielo avatar rfscholte avatar rmannibucau avatar slachiewicz avatar slawekjaranowski avatar trygvis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exec-maven-plugin's Issues

Nothing logged when command fails

The exec-maven-plugin fails, nothing is logged except that it FAILED.

The following is an example of such a failure:

[INFO] Building dCache FHS layout 2.14.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ dcache-fhs ---
[INFO] Deleting /scratch/jenkins/jenkins/workspace/dCache-v2.14/packages/fhs/target
[INFO] 
[...]
[INFO] 
[INFO] --- exec-maven-plugin:1.4.0:exec (default) @ dcache-fhs ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Logback config for building and testing ............ SUCCESS [  8.986 s]
[...]
[INFO] dCache FHS layout .................................. FAILURE [ 12.816 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17:27 min
[INFO] Finished at: 2015-11-18T19:42:24+01:00
[INFO] Final Memory: 131M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (default) on project dcache-fhs: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]

This makes it impossible to diagnose the problem from this information alone. To understand the failure, one must re-run maven with the -X option, which produces diagnostic information so the exact command is discoverable. Running this command can then reproduce the problem, so discovering the underlying cause.

I would expect that, if the command has failed, the output from stdout and stderr are presented in the log file, along with the command that failed.

Cheers,

Paul.

Define exit code to match

It should be very useful if we could define a custom exit code that would be matched when the external command exited, breaking or "making" the build.
Example of a possible plugin configuration

          <plugin>
                <artifactId>exec-maven-plugin</artifactId>
                <groupId>org.codehaus.mojo</groupId>
                <executions>
                    <execution>
                        <!-- Run our version calculation script -->
                        <id>Version Calculation</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>grep</executable>
                            <workingDirectory>${project.build.outputDirectory}</workingDirectory>
                            <arguments>
                                <argument>-q -R somestring *</argument>
                             </arguments>
                             <exitCode>1</exitCode>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

This would mean that, if grep didn't find the string 'somestring' the build would succeed, even if grep's exit code is '1' because, well exitCode=1 matches grep's exit code.

With the current usage, the build only succeeds if grep exits with '0'. You can't work around that, unless you create a shell script to execute grep and invert the exit code.

Maybe there's a workaround this (besides the shell script) that can give the result I'm after, that I don't know about.

maven iterator plugin is giving class not found exception.

my pom.xml is maven iterator plugin is , i added required dependency also . still i am getting class not Found exception give me the solution .

com.soebes.maven.plugins iterator-maven-plugin 0.3 Main generate-sources
      <goals>
        <goal>iterator</goal>
      </goals>
      <configuration>
        <items>
           <item>${projec.basedir}/ex.list,${iproject.basedir}/../build/object-src,DATA</item>
              </items>
        <pluginExecutors>
          <pluginExecutor>
             <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.3</version>
            </plugin>
            <goal>java</goal>
            <configuration>
                 <includeProjectDependencies>true</includeProjectDependencies>
                 <includePluginDependencies>true</includePluginDependencies>
                 <mainClass>com.Main</mainClass>
                <arguments>
                 <argument>@item@</argument>
                </arguments>
            </configuration>                
          </pluginExecutor>
        </pluginExecutors>
      </configuration>
    </execution>
  </executions>      
</plugin>

Multiple execution of plugin does not work

I tried implementing multiple plugin execution as described here: http://article.gmane.org/gmane.comp.java.maven-plugins.mojo.user/1307

I get an error:
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (default-cli) on project hsbc.ui.apps: The parameters 'executable' for goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec are missing or invalid -> [Help 1]

It seems the configuration block needs to live outside of the executions block. Is the FAQ incorrect (I can see it is old) and can this be done? Note that I need to execute two different executables.

Permission denied of shell script

[Problem Description]
I've written a deploy.sh for deploying projects.
Our deploy platform checked out the project from SVN, and executed "mvn clean package -U" to try packaging. Then maven showed me the error code=13 with permission denied, for that it could not directly execute the shell script due to no enough filesystem permission.

But it works fine and doesn't need permission if running "sh deploy.sh" instead of only "deploy.sh". And absolutely it also works fine if I chmod the shell script.

[Proposal]
My question/issue is :

  1. Did I do something wrong so that I failed in this kind of using case?
  2. If not, could it be an issue that running "sh xx.sh" instead of only "xx.sh" in case of these permission problems? Or just support executing a command instead of a file.
  <plugin>  
            <artifactId>exec-maven-plugin</artifactId>  
            <groupId>org.codehaus.mojo</groupId>  
            <version>1.5.0</version>  
            <executions>
                <execution>  
                    <id>deploy</id>  
                    <phase>package</phase>
                    <goals>  
                        <goal>exec</goal>  
                    </goals>  
                    <configuration>  
                        <executable>${project.basedir}/deploy.sh</executable>
                    </configuration>
                </execution>
            </executions>
        </plugin>

the trace stack is as follow (the chinese mean "Permission denied"):

java.io.IOException: Cannot run program "/data/dota/deploy/yz-deploy-serv-tag/target/deploy/tag/tag/yz-hornbill-analyz2/deploy.sh" (in directory "/data/dota/deploy/yz-deploy-serv-tag/target/deploy/tag/tag/yz-hornbill-analyz2"): error=13, 权限不够
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
        at java.lang.Runtime.exec(Runtime.java:617)
        at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
        at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: java.io.IOException: error=13, 权限不够
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.(UNIXProcess.java:186)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
        ... 30 more

need classpathDependencyExcludes support

Why required
When we enable "includeProjectDependencies" , the classpath build with all dependency. In our case we need to exclude sub-module dependency but require transitive dependency of that module.

Reference
maven-surefire-plugin(http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#classpathDependencyExcludes).

How to implement
List of dependencies to exclude from the classpath. Each dependency string must follow the format groupId:artifactId. For example: org.acme:project-a

<classpathDependencyExcludes>
   <classpathDependencyExclude>org.acme:project-a</classpathDependencyExclude>
</classpathDependencyExcludes>

Add support of includePluginDependencies for the exec goal

In some use cases, that'd be useful to add some dependencies to the classpath for the exec goal. For example, one could write:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <configuration>
        <executable>java</executable>
        <commandlineArgs>-classpath %classpath org.apache.camel.cdi.Main</commandlineArgs>
        <includePluginDependencies>true</includePluginDependencies>
    </configuration>
    <dependencies>
        <dependency>
            <groupId>io.astefanutti.camel.cdi</groupId>
            <artifactId>camel-cdi</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
</plugin>

So that the additional dependency is contained in the %classpath variable.

Cannot exec java --jar on AIX

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-fuse-patch</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>
                            <arguments>
                                <argument>-jar</argument>
                                <argument>${project.build.directory}/fuse-patch-installer.jar</argument>
                                <argument>${jboss.home}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

fails with

[INFO] --- exec-maven-plugin:1.4.0:exec (install-fuse-patch) @ fuse-patch-itests-standalone ---
Installing fuse-patch-distro-wildfly-1.4.1-SNAPSHOT.zip
Copy to repository: fuse-patch-distro-wildfly-1.4.1-SNAPSHOT.zip
Run command: java -Djboss.home=. -Dlogging.configuration=file:bin/fusepatch-logging.properties -jar jboss-modules.jar -mp modules org.wildfly.extras.patch --add file:fusepatch/repository/fuse-patch-distro-wildfly-1.4.1-SNAPSHOT.zip
Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.
Error: Command did not terminate normally

Execution of Windows executables broken in 1.5.0

I'm using exec-maven-plugin on Windows to run npm install in a JS project.

<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
    <execution>
        <id>npm install</id>
        <phase>generate-resources</phase>
        <goals>
            <goal>exec</goal>
        </goals>
        <configuration>
            <executable>npm</executable>
            <commandlineArgs>install --registry ${npm.registry}</commandlineArgs>
        </configuration>
    </execution>
</executions>

which works fine with 1.4.0 but switching to 1.5.0 results in

[INFO] --- exec-maven-plugin:1.5.0:exec (npm install) @ util ---
[ERROR] Command execution failed.
java.io.IOException: Cannot run program "C:\Program Files\nodejs\npm" (in directory "D:\Workspaces\git-repositories\myproject"): CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at java.lang.Runtime.exec(Runtime.java:620)
        at org.apache.commons.exec.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:61)
        at org.apache.commons.exec.DefaultExecutor.launch(DefaultExecutor.java:279)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:336)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:764)
        at org.codehaus.mojo.exec.ExecMojo.executeCommandLine(ExecMojo.java:711)
        at org.codehaus.mojo.exec.ExecMojo.execute(ExecMojo.java:289)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.io.IOException: CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
        at java.lang.ProcessImpl.start(ProcessImpl.java:137)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 30 more

exec-maven-plugin ignores my company-local repository from settings.xml

In my company we're using an artifactory which everybody has configured as a repository in their own ~.m2\repository\settings.xml file (and this works).

But for some reason the exec-maven-plugin ignores / dislikes this repository. In my exec plugin configuration I've got a dependency that is in the mentioned repository:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>
        <executions>
            ...
        </executions>
        <dependencies>
            <dependency>
                <groupId>com.sencha.gxt</groupId>
                <artifactId>gxt-themebuilder</artifactId>
                <version>3.1.4</version>
            </dependency>
        </dependencies>
    </plugin>

and when I run the build, maven correctly resolves the dependency from the company repository but the exec plugin fails after trying to get the dependency from the global maven repositories (but not from the company repository):

» mvn clean install                                                                                                                                     
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.pom (11 KB at 11.4 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-parent/3.1.4/gxt-parent-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-parent/3.1.4/gxt-parent-3.1.4.pom (15 KB at 45.1 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.pom (7 KB at 29.6 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar (1719 KB at 766.7 KB/sec)
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar (3706 KB at 852.4 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ my-project ---
[INFO] Deleting C:\workspace\MyProject\target
[INFO]
[INFO] --- maven-download-plugin:1.1.0:wget (download-phantomjs) @ my-project ---
[INFO] Got from cache: C:\Users\machner\.m2\repository\.cache\maven-download-plugin\phantomjs-1.9.6-windows.zip
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (generate-my-project-gen) @ my-project ---
Downloading: http://repo.maven.apache.org/maven2/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar
Downloading: http://repo.maven.apache.org/maven2/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
Downloading: https://oss.sonatype.org/content/repositories/google-snapshots/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.770s
[INFO] Finished at: Wed Oct 26 16:44:23 CEST 2016
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (generate-my-project-gen) on project my-project: Execution generate-my-project-gen of goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java failed: Plugin org.codehaus.mojo:exec-maven-plugin:1.3.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: com.sencha.gxt:gxt-themebuilder:jar:3.1.4, com.sencha.gxt:gxt:jar:3.1.4: Could not find artifact com.sencha.gxt:gxt-themebuilder:jar:3.1.4 in central (http://repo.maven.apache.org/maven2) -> [Help 1]

When inside my local repository I delete the _remote.repositories files for my dependency as suggested here the build passes. So it appears as if the exec plugin for some reason 'disliked' the company repository.

Any help would be appreciated.
Thanks,
Piotr

Clear error message if exec:exec is configured and the user uses "mvn exec:java" instead

We 'd like to use "mvn exec:exec" to easily run the examples of our open source project (optaplanner.org), but our users expect to be using "mvn exec:java".
When they use "exec:java", it's currently impossible to get the maven-exec-plugin to output something like "Please use exec:exec instead!". Instead, they get some weird classpath issue, spend a few hours debugging that, start complaining about how our examples don't just work out of the box as advertised, etc. In short, it causes a lot of unnecessary grief.

java.lang.String cannot be cast to org.codehaus.mojo.exec.Modulepath

I had some pomfiles which didn't specify a version for exec-maven-plugin. (Ignoring warnings at my own peril!)

When the new version became available in Maven Central, I started seeing errors along the lines of:

A type incompatibility occured while executing org.codehaus.mojo:exec-maven-plugin:1.6.0:exec: java.lang.String cannot be cast to org.codehaus.mojo.exec.Modulepath
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.codehaus.mojo:exec-maven-plugin:1.6.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0]  = file:/home/user/.m2/repository/org/codehaus/mojo/exec-maven-plugin/1.6.0/exec-maven-plugin-1.6.0.jar
[ERROR] urls[1]  = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[2]  = file:/home/user/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[3]  = file:/home/user/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[4]  = file:/home/user/.m2/repository/org/slf4j/slf4j-api/1.5.6/slf4j-api-1.5.6.jar
[ERROR] urls[5]  = file:/home/user/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[6]  = file:/home/user/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[7]  = file:/home/user/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[8]  = file:/home/user/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[9]  = file:/home/user/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[10] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[11] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[12] = file:/home/user/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[13] = file:/home/user/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.20/plexus-utils-3.0.20.jar
[ERROR] urls[14] = file:/home/user/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

There isn't any stack dump

I'm using Maven 3.2.5 and JDK 1.7.0_71, which are both older.

Obviously, I can fix the problem by going to the previous version of the plugin (1.5.0).

Is this an actual issue, or am I simply using a toolstack that's "too old"?

Unable to run process which is not in same folder

I am trying to run gulp with my project on Jenkins machine. I want to avoid global installation and setting path. Though I give absolute path of gulp installation, it is not getting picked up. There should be some way to specify absolute path

Below is my configuration

<groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.4.0</version> <executions> <execution> <id>exec-gulp</id> <phase>prepare-package</phase> <configuration> <executable>/a/b/c/node_modules/.bin/gulp</executable> <arguments> <argument>--dir</argument> <argument>${project.artifactId}-${project.version}</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>

Missing dependency google-collections

When I run mvn exec:java I got a ClassNotFoundException:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project ...: An exception occured while executing the Java class. com/google/common/collect/ImmutableList: com.google.common.collect.ImmutableList -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project ...: An exception occured while executing the Java class. com/google/common/collect/ImmutableList
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. com/google/common/collect/ImmutableList
        at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:345)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableList
        at com.github.fge.jsonschema.main.cli.CustomHelpFormatter.<clinit>(CustomHelpFormatter.java:37)
        at com.github.fge.jsonschema.main.cli.Main.<clinit>(Main.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 8 more

After adding the dependency to my local project, everything works fine:

          <dependency>
            <groupId>com.google.collections</groupId>
            <artifactId>google-collections</artifactId>
            <version>1.0</version>
          </dependency>

Error when using maven 3.2.1 and exec-maven-plugin

Hi All,

This is the error i get after i upgraded my maven version from 3.0.3 to 3.2.1 for the project.
I was using exec-maven-plugin version 1.2.1. Now i upgraded to 1.4.0 but i still get the error attached in this partebin:
http://pastebin.com/gRC35CtK

I am using the exec:java goal to run a validation tool. All works with maven 3.0.3 but when i switch to 3.2.1 i get this error.
I hope you can help me in determining what the problem is.
.

java.lang.reflect.InvocationTargetException running exec:java

I am a bit new to all of this but I can't seem to run something rather simple.

I am getting:

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:294)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: javax/enterprise/inject/UnsatisfiedResolutionException
    at ar.uba.fi.fallas.App.main(App.java:29)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: javax.enterprise.inject.UnsatisfiedResolutionException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

But everything should be there and properly configured. It builds fine. Any pointer?

I am using Weld, CDI an drools.

Pretty much followed all of https://salaboy.com/2015/10/20/back-to-the-basics-getting-started-with-drools-6-3-0-final with latest versions.

Graceful shutdown on JVM termination

When the virtual machine is terminated in response to a user interrupt, such as typing ^C, the parent process should wait until the child process exit for a certain amount of time configurable, and properly flush and close the process steams.

One typical issue with the current absence of graceful shutdown is the child process logs emitted during the child JVM shutdown sequence that are not streamed back to the parent stream handler.

Property in the configuration for ignoring errors during execution

It would be nice if there is a property like failOnError for additional control over the execution exit.
This would be useful mostly when UI components are being build and bundled.
The failOnError can be achieved if we wrap the commands in a shell script but this is additional step.

Plugin does not use jdk from toolchains plugin

I'm trying execute JDK9 java code using the exec:exec goal. The executabe is the java executable from the JDK9 with Jigsaw. Maven itself runs with a JDK8 JVM.

Although I configured the JDK9 via jdk toolchain, exec-maven-plugin keeps using the jdk8-java-executable.

Within the very same pom.xml I am using the maven-compiler-plugin, which recognizes the toolchain and correctly uses the version 9 javacexecutable.

What am I doing wrong?

Plugin Seems to Overwrite java.wt.headless with true

I have the following configuration snippet as i want to run a GUI via this plugin.

        <configuration>
          <executable>java</executable>
          <arguments>
            <argument>-classpath</argument>
            <classpath />
            <argument>-Djava.awt.headless=false</argument>
           <argument>MyGUI</argument>

But when i start i get
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
at java.awt.Window.(Window.java:536)
at java.awt.Frame.(Frame.java:420)
at javax.swing.JFrame.(JFrame.java:233)

Using jvisualvm i look and the system properties says java.awt.headless=true even though i have set as argument.

Any ideas, thanks.
Tim

Multi-argument parameter handling

I am attempting to add a user configurable multi-argument parameter to an exec-maven-plugin invocation in the verify phase of my project. However, the multi-argument parameter is always attached to the Apache CommandLine object as a single argument (with escaping so it goes that way into the command).

What I would like to be able to do is this:

<configuration>
    <executable>java</executable>
    <workingDirectory>${project.basedir}/src/test/features</workingDirectory>
    <arguments>
        <argument>...</argument>
        <argument>-classpath</argument>
        <classpath/>
        <argument>cucumber.api.cli.Main</argument>
        <argument>...</argument>
        <argument>${cuke.files}</argument>
    </arguments>
</configuration>

And have the execution pass the cuke.files variable as multiple arguments on the command line to the executing command.

However, if I pass a multi-argument (space separated) value into the cuke.files variable in Maven, the CommandLine goes as one parameter escaping the spaces.

Is there a way to achieve this functionality with the current version of the plugin, and if so, how do I do it? Or, if that functionality is not handled today and I put together a pull request for splitting on spaces in an argument, would someone be willing to merge it into the mainline?

EnvStreamConsumer should limit split

Line 31 of https://github.com/trustin/exec-maven-plugin/blob/master/src/main/java/kr/motd/maven/exec/EnvStreamConsumer.java probably should use the limit option. At present, any environment variables have the '=' character as part of their valid value will not get parsed correctly. For example:

PYSPARK_SUBMIT_ARGS="--master yarn --conf some.spark.setting=somevalue"

The current code:
String[] tokens = StringUtils.split( line, "=");

will yield a String array of size 3: ['PYSPARK_SUBMIT_ARGS', '--master yarn --conf some.spark.setting', 'somevalue'].

At present, the code will only accept any array of size 2 before it maps values.
Simply limiting the split as follows should take care of the issue:
String[] tokens = StringUtils.split( line, "=", 2);

At very least, the code probably should be much noisier about it rejecting a KEY,VALUE pairs b/c VALUE happens to have a '=' character in it.

InvocationTargetException

I haven't changed anything in my codes and I'm just trying to run the project again and here is my error:

➜  my-app mvn exec:java
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.mycompany.app:my-app:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.codehaus.mojo:exec-maven-plugin is missing. @ line 52, column 17
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- exec-maven-plugin:1.4.0:java (default-cli) @ my-app ---
Okcforum Unix Users Group
[WARNING] 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
    at com.mycompany.app.App.make(App.java:83)
    at com.mycompany.app.App.main(App.java:54)
    ... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.006 s
[INFO] Finished at: 2016-03-04T19:16:55+03:30
[INFO] Final Memory: 10M/213M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project my-app: An exception occured while executing the Java class. null: InvocationTargetException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Anybody has any idea?! :-?

how to execute maven exe plugin in parent pom

I have a maven exec plugin which execute main class with arguments in child its executed successfully , while i am putting in parent pom mentioning child as a module , it is not executing maven exec plugin and it is not finding out the arguments
arguments lists are

ex.list

Cannot store value into array when use mvn exec:java

command:
plugin version: 1.4.0

mvn exec:java -Dexec.mainClass="com.demo.Hello"

error:

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default-cli) on project h2: Unable to parse configuration of mojo org.codehaus.mojo:exec-maven-plugin:1.4.0:java for parameter arguments: Cannot store value into array
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:220)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginConfigurationException: Unable to parse configuration of mojo org.codehaus.mojo:exec-maven-plugin:1.4.0:java for parameter arguments: Cannot store value into array
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:607)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:539)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:119)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
Caused by: org.codehaus.plexus.component.configurator.ComponentConfigurationException: Cannot store value into array
    at org.codehaus.plexus.component.configurator.converters.composite.ArrayConverter.fromConfiguration(ArrayConverter.java:80)
    at org.eclipse.sisu.plexus.CompositeBeanHelper.convertProperty(CompositeBeanHelper.java:273)
    at org.eclipse.sisu.plexus.CompositeBeanHelper.setProperty(CompositeBeanHelper.java:210)
    at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:101)
    at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:34)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:577)
    ... 22 more
Caused by: java.lang.ArrayStoreException
    at java.lang.System.arraycopy(Native Method)
    at java.util.ArrayList.toArray(ArrayList.java:306)
    at org.codehaus.plexus.component.configurator.converters.composite.ArrayConverter.fromConfiguration(ArrayConverter.java:68)
    ... 27 more

Maven exec plugin execution stopped at parent pom

Below lines are stopped in maven exec plugin and it is working fine in running child , can any one knows

[DEBUG] Setting accessibility to true in order to invoke main().
Invalid source file ex.list

Question: Why is ExecMojoTest searching for "mvn.cmd"?

I tried to fix a bug which happens on Windows, but I do not understand what that particular code is actually good for. Maybe someone could briefly explain?

ExecMojoTest fails because it expects to find relative name "mvn.cmd" while actually it finds absolute name "C:\Program Files\mvn\bin\mvn.cmd" on my disk. I assume this came up by introduction of two useful features: Returning an absolute name, and scanning PATH. Possibly nobody noticed as I assume most run their test suite on Linux.

Now my problem is: I can fix it by simply replace "mvn.cmd" by "xxx". As a result, nothing is found on my disk, hence, no absolute path is returned. Fine. Test pass. Great. But is that really what that test suite shall check (NOT finding something)? Because that means, the ExecMojoTest is useless then: It checks for something it does never find, and is happy with that, but it never checks whether it would really find something on disk? This is simply weird.

Ideas?

Execution of powershell.exe

When executing powershell.exe on windows, the plugin is frozen. Looks like the powershell process is waiting for an input in the StdIn Stream.

A simple workaround is to send an empty input file in the StdIn by adding an additional parameter in the parameter in the command line ( < emptyFile.txt) .

A simple way to fix that, is to send a fake input in the stdIn stream for powershell.

Issue with async and outputFile

When I use both the async and outputFile option this does not seem to work. The output file is created but empty and the process hangs after a while trying to write to stdout.

I'm using 1.5.0 under Windows

Problem when running plink.exe with '<'

Sorry, I could not find the root cause, so I tell you my use case:

PLINK is an SSH client for windows
If I run it from the command line, it works like a charm:

plink.exe myuser@myhost -T -ssh -2 $SHELL /dev /stdin 'a b c d' < test.sh
Output:
execution parameters: a b c d

My test.sh:

#!/bin/bash
echo "execution parameters: $@"

But if I put that into exec:exec, it fails:

[DEBUG] Executing command line: [c:\apps\putty\plink.exe, myuser@myhost, -T, -ssh, -2,
$SHELL, /dev/stdin, a b c d, <, test.sh]
bash: test.sh: No such file or directory
[INFO] ------------------------------------------------------------------------

pom.xml:

<plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.4.0</version> 
     <executions> 
          <execution>
                <id>test</id>
                <phase>pre-integration-test</phase>
                <goals>
                     <goal>exec</goal>
                </goals>
                <configuration>
                      <executable>c:\apps\putty\plink.exe</executable>
                      <commandlineArgs>myuser@myhost -T -ssh -2 $SHELL /dev/stdin 'a b c d' &lt; test.sh"</commandlineArgs>
                </configuration>
           </execution>
    </executions> 
</plugin>

My test.sh:

#!/bin/bash
echo "execution parameters: $@"

It does not work regardless the path I put test.sh.
It seems that exec:exec messes up the execution path somehow...

If I execute a .bat file: it passes '< test.sh' correctly.

Detection for Win32 .cmd/.bat should only look at the file name

https://github.com/mojohaus/exec-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/exec/ExecMojo.java#L588 tries to detect whether there is a .cmd/.bat file with the same name as the specified executable, and run that instead. This logic does not work when the path to the executable contains a ., for example in this configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.4.0</version>
    <executions>
        <execution>
            <id>exec-gulp</id>
            <phase>process-resources</phase>
            <goals>
                <goal>exec</goal>
            </goals>
            <configuration>
                <executable>${project.basedir}/node_modules/.bin/gulp</executable>
            </configuration>
        </execution>
    </executions>
</plugin>

Just testing the file name would still lead to potential issues, as one could have files like foo.bar, so I think the best approach here is to just check whether there is a file with a .cmd/.bat extension, regardless of whether there is a . in the name.

Will try to provide a patch soon.

1.5.0. jar corrupt

[ERROR] Failed to parse plugin descriptor for org.codehaus.mojo:exec-maven-plugin:1.5.0

When I manually download the jar from http://mvnrepository.com/ and try to open it with 7zip it fails to open, so the file is really corrupt

Support modulepath (Java9)

With java9 the java executable is extended with the option of executable modules. So it must be possible specify the modules as well.

Exposing additionalClasspathElements in java goal as command line parameter?

First of all, thanks for the great tool!

It looks like solving this issue is straightforward (haven't tried yet), but was wondering what the rationale for specifying additionalClasspathElements in the pom only was. Is there something more complex than adding the property Parameter or some consequence to exposing?

Thanks!

chmod: cannot access with exec-maven-plugin version later 1.1

Consider a cofiguration:

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>${exec-maven-plugin.version}</version>
    <executions>
      <execution>
        <id>script-chmod</id>
        <phase>package</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <workingDirectory>${project.build.directory}</workingDirectory>
          <executable>chmod</executable>
          <arguments>
            <argument>+x</argument>
            <argument>${project.build.directory}/target/tomcat/bin/*.sh</argument>
          </arguments>
        </configuration>
      </execution>
      <execution>
        <id>start-tomcat</id>
        <phase>package</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <executable>target/tomcat/bin/startup.sh</executable>
        </configuration>
      </execution>
    </executions>
  </plugin>

When exec-maven-plugin.version is 1.1 everything works, but when it 1.5.0, 1.4.0 ot 1.3.2 I got en error: chmod: cannot access ‘/mypath/tomcat/bin/*.sh’: No such file or directory

Note
version 1.1 works without workingDirectory tag.

To experiment you can download and extract tomcat version 7.0.68

Operation system is Ubuntu 15.10
java version is 1.8.0_66-b17
maven version 3.3.3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.