如何设置从一个Ant构建文件Eclipse构建路径和类路径? [英] How do I set the Eclipse build path and class path from an Ant build file?

查看:300
本文介绍了如何设置从一个Ant构建文件Eclipse构建路径和类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于蚂蚁和Eclipse的讨论,但pviously回答没有$ P $似乎帮助我。

There's a lot of discussion about Ant and Eclipse, but no previously answered seems to help me.

这里的交易:我试图构建与蚂蚁在命令行编译成功的Java程序。 (为了进一步迷惑的问题,我试图编译程序ANT本身。)

Here's the deal: I am trying to build a Java program that compiles successfully with Ant from the command-line. (To confuse matters further, the program I am attempting to compile is Ant itself.)

我真正想要做的就是把这个项目到Eclipse中,并让它在Eclipse编译,这样的类型绑定和绑定变量(自命名的Eclipse JDT)的正确解析。我需要这个,因为我需要运行上是基于Eclipse JDT的顶部code静态分析。正常的方式,我把一个Java项目到Eclipse中,这样Eclipse将建立并解决所有的绑定是刚刚导入源目录到Java项目,然后告诉它使用src /主/目录作为源目录。

What I really want to do is to bring this project into Eclipse and have it compile in Eclipse such that the type bindings and variable bindings (nomenclature from Eclipse JDT) are correctly resolved. I need this because I need to run a static analysis on the code that is built on top of Eclipse JDT. The normal way I bring a Java project into Eclipse so that Eclipse will build it and resolve all the bindings is to just import the source directories into a Java project, and then tell it to use the src/main/ directory as a "source directory."

不幸的是,这样做,用Ant使构建失败与众多的编译错误。这在我看来,Ant构建文件是建立在类路径和正确的构建路径(可能排除某些源文件)和Eclipse没有这个信息。

Unfortunately, doing that with Ant causes the build to fail with numerous compile errors. It seems to me that the Ant build file is setting up the class path and build path correctly (possibly by excluding certain source files) and Eclipse does not have this information.

有没有办法采取类路径和放大器;建立嵌入在一个Ant构建文件路径信息,并考虑到信息到Eclipse把它的.project以及classpath文件?我试过,创建从现有的构建文件的新项目(在文件菜单中的选项),但是这并没有帮助。该项目仍然具有相同的编译错误。

Is there any way to take the class path & build path information embedded in an Ant build file, and given that information to Eclipse to put in its .project and .classpath files? I've tried, creating a new project from an existing build file (an option in the File menu) but this does not help. The project still has the same compile errors.

谢谢,
内尔斯

Thanks, Nels

推荐答案

我用常春藤来管理我的ANT类路径,我强烈建议学习它是如何工作的。

I use the ivy to manage my ANT classpaths, I highly recommend learning how it works.

有一个 eclipse插件将从管理Eclipse类路径同样的的ivy.xml 的蚂蚁用来定义它的依赖。文件

There is an eclipse plugin that will manage the eclipse classpath from the same ivy.xml file that ANT uses to define it's dependencies.

这篇关于如何设置从一个Ant构建文件Eclipse构建路径和类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆