【发布时间】:2015-12-02 19:54:51
【问题描述】:
在模块库的子 pom.xml 中出现此错误
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (install-uum) on project libs: Command execution failed. Cannot run program "mvn" (in directory "D:\xyz\build\project_name\Build\app_name\libs"): CreateProcess error=2, The system cannot find the file specified
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<inherited>false</inherited>
<executions>
<execution>
<id>install-uum</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>install:install-file</argument>
<argument>-Dfile=${basedir}/entity-service-1.0.0.jar</argument>
<argument>-DgroupId=com.xyz.app</argument>
<argument>-DartifactId=entity-service</argument>
<argument>-Dversion=1.0.0</argument>
<argument>-Dpackaging=jar</argument>
</arguments>
</execution>
看起来 maven 没有在路径中设置。有什么方法可以在 pom.xml 的 PATH 中设置 maven 可执行文件,而不是从命令行执行 set PATH=%M2_HOME%\bin;%PATH%?
【问题讨论】:
-
你为什么要这个?将它放在您的环境中更为常见。但也许this 是您正在寻找的...
-
是的,我正在寻找 pom.xml 以在构建时将 m2_home 放入路径中。
-
为什么要通过 exec-maven-plugin 执行 maven?
标签: maven