我使用统一的Maven构建改造了大量现有的Java项目。由于每个项目成熟,并已建立了基于Ant构建所有我使用maven-antrun-plugin
执行现有build.xml
如下:JAVA_HOME被Maven破坏
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<configuration>
<tasks>
<ant antfile="build.xml" target="compile" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
当我运行mvn compile
构建失败,此消息:
[INFO] An Ant BuildException has occured: The following error occurred
while executing this line:
build.xml:175: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Java\jdk1.6.0_13\jre"
什么难题我是
- 我有
JAVA_HOME=C:\Java\jdk1.6.0_13
作为我的环境设置的一部分,并在执行mvn.bat
是EXA ctly值我得到,但是当你在错误信息中看到它出来作为C:\Java\jdk1.6.0_13\jre
- 如果我运行
ant compile
一切编译就好
这是否意味着或许maven-antrun-plugin
确实像set JAVA_HOME=%JAVA_HOME%\jre
?我搜索我的批处理/建造文件,我无法找到此发生变化
感谢您扩大断开的链接! – wrgrs 2015-08-28 14:36:36
您先生,是互联网英雄,谢谢,我正在寻找这个小时。有用。我只是改为java版本1.8.0。 这应该是现在接受的答案! – Hoto 2015-09-11 16:48:06