[英]Ant Java Build Path set by Eclipse is Missing a Library at Compile Time
I'm using eclipse and ant to compile a java project. 我正在使用eclipse和ant来编译Java项目。 The ant compile script calls
javac
using a classpath refid of classpath
, which is set based on System Property variable java.build.path
. 蚂蚁编译脚本调用
javac
使用的类路径REFID classpath
,它是基于系统属性变量设置java.build.path
。
My java.build.path
variable is missing a library that was specified in 我的
java.build.path
变量缺少在中指定的库
Project->Properties->Java Build Path->Libraries.
项目->属性-> Java构建路径->库。
That is, the external jar was properly added to the list of libraries to add to the build path, is not missing or corrupt, and I have every expectation that eclipse would include the library in the build path. 也就是说,外部jar已正确添加到要添加到构建路径的库列表中,并且没有丢失或损坏,并且我完全希望Eclipse将在构建路径中包含该库。 My build fails because
java.build.path
is missing this library. 我的构建失败,因为
java.build.path
缺少此库。
Furthermore, the file <projectDir>/.classpath
contains a valid classpathentry
element for the missing jar file. 此外,文件
<projectDir>/.classpath
包含缺少的jar文件的有效classpathentry
元素。
When building, javac
fails at an import statement, claiming that the package does not exist. 生成时,
javac
在import语句中失败,声称该软件包不存在。 The value of java.build.classpath
contains many of the libraries I set in the project properties, but does not include the missing library. java.build.classpath
的值包含我在项目属性中设置的许多库,但不包括缺少的库。 Its as if the project property for that external jar was never set. 好像从未设置该外部jar的project属性。
For what its worth, the missing library is jboss/lib/jbosssx.jar
对于它的价值,缺少的库是
jboss/lib/jbosssx.jar
Any help here would be appreciated. 在这里的任何帮助,将不胜感激。
At first, 首先,
jbosssx.jar
jar file from this link jbosssx.jar
jar文件 jboss/lib
jboss/lib
文件夹中 Hope it will solve your issue. 希望它能解决您的问题。
Sometimes jar files need to keep in lib
folder physically. 有时jar文件需要物理上保留在
lib
文件夹中。 For this reason, you can put the jar file in your project lib
folder. 因此,您可以将jar文件放在项目
lib
文件夹中。
I found where my configuration was messed up. 我发现我的配置混乱了。
Using External Tools Configurations
within eclipse, I found another Classpath
settings tab for my ant build that did not contain my library. 在eclipse中使用
External Tools Configurations
,我为我的蚂蚁构建找到了另一个不包含我的库的Classpath
设置选项卡。
Adding my library here caused the build to succeed! 在这里添加我的库使构建成功!
Skywalker, thanks for the suggestion. 天行者,谢谢你的建议。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.