Java 在 Eclipse 中导入 ant build.xml
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3880350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing ant build.xml in Eclipse
提问by Suresh
I have an android project that uses ant to build, is it possible to import this ant project in eclipse IDE?
我有一个使用 ant 构建的 android 项目,是否可以在 eclipse IDE 中导入这个 ant 项目?
update : There is an option to create project using ant build.xml
in eclipse File->New->Project->Java->Java project from existing ant Buildfile. and if the build.xml file is selected it show error Specified buildfile does not contain a javac task
更新:有一个选项可以build.xml
在 eclipse File->New->Project->Java->Java 项目中使用 ant 从现有的 ant Buildfile创建项目。如果选择了 build.xml 文件,则会显示错误Specified buildfile does not contain a javac task
I guess javac is declared in this task
我猜 javac 是在这个任务中声明的
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
回答by alvinsj
Try the following method, got it work for me.
试试下面的方法,让它对我有用。
- Make sure you have ant installed
- Create new project> android project > choose from exisiting source (your project source)
- Download ant-contrib.jar, then unzip it and put the jar file to where you prefer.
- Add the ant-contrib jar file to Eclipse: Window>Preferences>Ant>Runtime>Global Entries>Add external jar
- Configure your build.properties. (copy and edit build.properties.example to build.properties)
- Now open build.xml in editor in Eclipse then hit Run
- Add the built jar files in your project properties, Project Properties>Java Build Path>Add JAR
- 确保你安装了 ant
- 创建新项目> android 项目> 从现有源(您的项目源)中选择
- 下载ant-contrib.jar,然后解压缩并将 jar 文件放在您喜欢的位置。
- 将 ant-contrib jar 文件添加到 Eclipse:Window>Preferences>Ant>Runtime>Global Entries>Add external jar
- 配置您的 build.properties。(复制并编辑 build.properties.example 到 build.properties)
- 现在在 Eclipse 的编辑器中打开 build.xml 然后点击运行
- 在您的项目属性中添加构建的 jar 文件,Project Properties>Java Build Path>Add JAR
回答by Tejas
just simply import "existing projects into workspace" and import your project. then open 'ant' window from windows-->show/view --> ant
只需简单地将“现有项目导入工作区”并导入您的项目。然后从 windows-->show/view-->ant 打开“ant”窗口
drag-drop your ant file from project explorer to the ant window.
将您的 ant 文件从项目资源管理器拖放到 ant 窗口。
click to expand, and select the target you want to run ->right click -> run as ANT
单击展开,然后选择要运行的目标 -> 右键单击 -> 作为 ANT 运行
your setup should be ok with this.
你的设置应该没问题。