Java – exec Maven plugin means that the specified program cannot be run, even if it is on path

Editor: 20140716

Solution found

tl; Dr = exec Maven plugin is not recognized CMD file, and only The bat file is recognized as an executable script Rename grunt cmd – > grunt. bat,bower. cmd – > bower. Bat as a solution

NPM installation - G grunt cli is completed on my system, and the hum is definitely on the path

When I run Maven installation, but it doesn't seem to register

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 
    (build-spa-bower) on project foobar: Command execution Failed. 
    Cannot run program "grunt" (in directory "C:\workspace\foobar\src\main\spa"): 
    CreateProcess error=2,The system cannot find the file specified -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: 
    Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 
    (build-spa-bower) on project foobar: Command execution Failed.

Just make sure that I have executed this on the same terminal

cd C:\workspace\foobar\src\main\spa
grunt build

... in the same terminal where I issued the Maven command above, grunt performed well

Does the exec Maven plugin use the path environment variable, or does it need to be told that the executable appears in other ways?

Edit:

This documentation indicates that the executable on path should be found, so it further hinders me

Solution

In addition to bguiz's answer, this will be the best solution. I created a solution using Maven configuration file to bypass the problem

This is a temporary solution until the Maven exec plugin bug is fixed

Please remind the error report here: http://jira.codehaus.org/browse/MEXEC-118

Edit: the error has been resolved. You can fix it by pointing to 1.4 - snapshot

<project>
(...)
    <profiles>
        <profile>
            <id>grunt-exec-windows</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>${exec-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>grunt-default</id>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <executable>cmd</executable>
                                    <arguments>
                                        <argument>/C</argument>
                                        <argument>grunt</argument>
                                    </arguments>
                                </configuration>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>