Ant 无法识别类路径
我不明白为什么这个 Ant 任务失败:
<javac srcdir="src" destdir="bin" verbose="true" classpath="lib/*;${MyCommons.proj.path}/MyCommons.jar" />
我的 jar 都在 lib 中,再加上一个外部 jar。当我将鼠标悬停在类路径部分上时,Eclipse 显示此配置可以识别所有 jar 文件。
编译时,我收到 100 个无法找到此包或符号的错误(它没有找到 jars)。
[javac] Compiling 51 source files to C:\MyProjects\MyCommons\bin
[javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Notification.java:3: package org.joda.time does not exist
[javac] import org.joda.time.DateTime;
[javac] ^
[javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Transaction.java:5: package org.joda.time does not exist
[javac] import org.joda.time.DateTime;
我已经尝试了我能找到的每种格式的类路径,classpathref's,embedded,文件集,文件列表等大约一个小时。
有人看到错误吗?
在此调用之前,我调用了
<ant target="compile" dir="/some/other/project"/>
Removing this 允许 javac 命令成功编译。
I can't see why this Ant task fails:
<javac srcdir="src" destdir="bin" verbose="true" classpath="lib/*;${MyCommons.proj.path}/MyCommons.jar" />
My jars are all in lib, plus one external jar. When I mouse-over the classpath section eclipse shows all the jar files are recognized by this configuration.
On compile, I get 100 errors of can't find this package or symbol (it's not finding the jars).
[javac] Compiling 51 source files to C:\MyProjects\MyCommons\bin
[javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Notification.java:3: package org.joda.time does not exist
[javac] import org.joda.time.DateTime;
[javac] ^
[javac] C:\MyProjects\MyCommons\src\com\proxyandvpn\datamodel\Transaction.java:5: package org.joda.time does not exist
[javac] import org.joda.time.DateTime;
I've tried every format of classpath I can find, classpathref's, embedded , filesets, filelists, , etc. for about an hour.
Does anyone see an error?
Prior to this call I have a call to
<ant target="compile" dir="/some/other/project"/>
Removing this allowed the javac command to compile successfully.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你应该尝试这个(我自己没有运行过,但我认为它有效):
然后
如果有错误,请将它们放在评论中。我会纠正它。
you should try this (did not run myself but I think it works):
and then
If there are errors, put them in comments. I will correct it.
我遇到了完全相同的问题。这帮助了我:
I had the exact same problem. This helped me: