Maven 编译器插件分支选项不起作用
我有一个带有以下编译器插件的 maven pom 文件:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<executable>${path_to_JDK6}</executable>
<fork>true</fork>
<compilerVerison>1.6</compilerVerison>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
我系统的 JAVA_HOME 设置为 1.5 JDK。当我运行 mvn package 时,maven 抛出以下错误消息:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6
Usage: javac <options> <source files>
有谁知道为什么 Maven 使用 1.5 JDK 而不是分叉到 1.6 可执行文件?有没有我可以使用的调试选项? Maven 2 中的 fork 和可执行选项是否损坏?
注意:我的系统管理员不允许我更改 JAVA_HOME 的值,并且我的一些新库是为 java 6 编写的。所以我想找到一种解决方法来使 maven 使用 JDK 1.6 进行编译。
I have a maven pom file with the following compiler-plugin:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<executable>${path_to_JDK6}</executable>
<fork>true</fork>
<compilerVerison>1.6</compilerVerison>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
My system's JAVA_HOME is set to a 1.5 JDK. When I run mvn package, maven throws the following error message:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.6
Usage: javac <options> <source files>
Does anyone have any ideas about why Maven is using the 1.5 JDK instead of forking to the 1.6 executable? Is there any debugging option that I could use? Are the fork and executable options broken in Maven 2?
Note: My system admin would not allow me to change the value of JAVA_HOME and some of my new libraries are written for java 6. So I would like to find a workaround to make maven compile with JDK 1.6.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的 ${path_to_JDK6} 变量仅包含包含 JDK 的文件夹的路径。它不包括 /bin/javac。当我添加 /bin/javac 时,会调用 1.6 编译器。
My ${path_to_JDK6} variable only included the path to the folder containing the JDK. It did not include the /bin/javac. When I added /bin/javac, the 1.6 compiler was invoked.