简体   繁体   English

Eclipse设置的Ant Java构建路径在编译时缺少库

[英]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, 首先,

  1. Download jbosssx.jar jar file from this link 从此链接下载jbosssx.jar jar文件
  2. Then keep the jar file in the folder jboss/lib 然后将jar文件保存在jboss/lib文件夹中

Hope it will solve your issue. 希望它能解决您的问题。

UPDATE: 更新:

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM