java – exec-maven-plugin表示无法运行指定的程序,即使它在PATH
编辑20140716:
Solution found tl; dr = exec-maven-plugin不能识别.cmd文件,而只能将.bat文件识别为可执行脚本.重命名grunt.cmd – > grunt.bat,bower.cmd – > bower.bat等作为解决方法. 在我的系统上完成了npm安装-g grunt-cli,哼哼声绝对是在PATH上 当我运行maven安装,但这似乎没有注册. [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:workspacefoobarsrcmainspa"): 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. 只要确定,在同一个终端,我已经执行了这个 cd C:workspacefoobarsrcmainspa grunt build …在我发出上面的maven命令的同一个终端中,grunt执行得很好. exec-maven-plugin是否使用PATH环境变量,还是需要被告知这个可执行文件以其他方式出现? 编辑: 这个documentation表明,应该找到PATH上的可执行文件,所以它进一步阻碍了我. 解决方法
除了bguiz的答案,这将是最好的解决方案,我创建了一个解决方法,使用Maven配置文件,绕过了问题.
这是一个临时解决方案,直到maven-exec-plugin的bug得到修复. 请在这里提醒错误报告:http://jira.codehaus.org/browse/MEXEC-118 编辑:错误已解决,您可以指向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> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |