exec-maven-plugin
exec-maven-plugin copied to clipboard
Exec tries to execute the *nix executable on windows systems
For example, with executable name npm
, and when both npm
and npm.cmd
are present, the plugin tries to execute the npm
instead of the npm.cmd
file on windows. It then fails because npm
isn't a valid windows executable.
Can you show the configuration of the exec-maven-plugin in an example project?
I can show it here:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<workingDirectory>target</workingDirectory>
</configuration>
<executions>
<execution>
<id>Run `npm install`</id>
<phase>process-resources</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
It works just fine on my mac, but one of my coworkers was having problems on his windows machine. Going to the directory where npm was installed and renaming the *nix
script to some other name (npm
to npm_
, for example) allowed the plugin to pick up npm.cmd
and work as expected.
That's what I expected. The configuration using executable
shows an assumption for unix which should be handled different. Can simply being solved by using a profile activated by the os and selected the appropriate name for the platform you ran on...
Yes, that was the workaround we used. I put this up here for the benefit of those who may have the same problem, and because the plugin could probably be smart enough to pick up the appropriate version of the executable.
This issue was introduced in version 1.5.0 by a repair to issue #24.
Duplicate of #42.
Marked as duplicate (6 years ago), so I’m closing this.