exec-maven-plugin icon indicating copy to clipboard operation
exec-maven-plugin copied to clipboard

Exec tries to execute the *nix executable on windows systems

Open ericbf opened this issue 8 years ago • 6 comments

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.

ericbf avatar Aug 31 '16 15:08 ericbf

Can you show the configuration of the exec-maven-plugin in an example project?

khmarbaise avatar Aug 31 '16 18:08 khmarbaise

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.

ericbf avatar Aug 31 '16 19:08 ericbf

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...

khmarbaise avatar Aug 31 '16 19:08 khmarbaise

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.

ericbf avatar Aug 31 '16 19:08 ericbf

This issue was introduced in version 1.5.0 by a repair to issue #24.

ikysil avatar Oct 23 '16 19:10 ikysil

Duplicate of #42.

ikysil avatar Oct 23 '16 20:10 ikysil

Marked as duplicate (6 years ago), so I’m closing this.

ericbf avatar Nov 01 '22 02:11 ericbf