【发布时间】:2012-12-04 14:54:45
【问题描述】:
我正在尝试在我的 Eclipse 中设置 xmlbeans-maven-plugin 2.3.3,虽然一切似乎都正常,但由于无法找到文件 C:\Users\Daniel\Workspace\MyProject\javac,它失败并出现 java.io.IOException。
这很奇怪,因为 javac is 在系统的 %PATH% 上,为什么它会尝试在 %PROJECT_LOC% 中找到它?
我发现this problem description 听起来与我的非常相似,但我将 JDK 路径放在所有其他路径的前面,但这并没有帮助。
知道如何告诉xmlbeans-maven-plugin在哪里寻找javac吗?
更新 1:我尝试通过简单地将 javac.exe 复制到项目目录来解决此问题,至少现在它找到了它,但问题转移到了:
java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main" Could not find the main class: com.sun.tools.javac.Main. Program will exit.
任何可以帮助提出正确解决方案的见解(例如.m2/settings.xml?)将不胜感激。
更新 2: 我也尝试了this little solution,我在搜索中找到了:
<settings xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>c:\maven\repository</localRepository>
<configuration>
<compiler>C:\Program Files (x86)\Java\jdk1.6.0_37\bin\javac.exe</compiler>
</configuration>
</settings>
但这并没有帮助插件找到javac。它仍然抱怨 javac.exe 的“系统找不到指定的文件”。
【问题讨论】:
标签: maven javac m2e xmlbeans xmlbeans-maven-plugin