Importing ant build.xml in Eclipse

2019-01-13 07:24发布

I have an android project that uses ant to build, is it possible to import this ant project in eclipse IDE?

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

I guess javac is declared in this task

<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>

3条回答
地球回转人心会变
2楼-- · 2019-01-13 07:27

just simply import "existing projects into workspace" and import your project. then open 'ant' window from windows-->show/view --> ant

drag-drop your ant file from project explorer to the ant window.

click to expand, and select the target you want to run ->right click -> run as ANT

your setup should be ok with this.

查看更多
我想做一个坏孩纸
3楼-- · 2019-01-13 07:44

Try the following method, got it work for me.

  1. Make sure you have ant installed
  2. Create new project> android project > choose from exisiting source (your project source)
  3. Download ant-contrib.jar, then unzip it and put the jar file to where you prefer.
  4. Add the ant-contrib jar file to Eclipse: Window>Preferences>Ant>Runtime>Global Entries>Add external jar
  5. Configure your build.properties. (copy and edit build.properties.example to build.properties)
  6. Now open build.xml in editor in Eclipse then hit Run
  7. Add the built jar files in your project properties, Project Properties>Java Build Path>Add JAR
查看更多
仙女界的扛把子
4楼-- · 2019-01-13 07:45

From this link:

  1. Open Eclipse, select File > New > Project
  2. Select "Java Project from Existing Ant Build File"
  3. Show your build file and write a project name
查看更多
登录 后发表回答