2 Replies Last post: Feb 22, 2014 8:49 PM by Zemian Deng  
Zemian Deng Novice 128 posts since
Nov 8, 2012
Currently Being Moderated

Feb 22, 2014 8:16 AM

How to import/create project from existing Ant build.xml file?



I can't seem to find a way to import an existing ant based project that already has the build.xml configured. I am expected the IDE to able to read the file and at least setup the source directory and classpath/External Libraries properly. Can this be done on IDEA 12?




Hans Nücke Newbie 14 posts since
Aug 4, 2013
Currently Being Moderated
Feb 22, 2014 2:49 PM in response to: Zemian Deng
Re: How to import/create project from existing Ant build.xml file?

I'm not sure this is the correct, best or easiest way, but it worked for me ;-)

- open your build configuration (e.g. Run - Edit Configurations)

- select the configuration you want to modify and find the "Before launch" area on the bittom right of the window

- Click the grenn "+" sign

- Click "Run external tool"

- Click the green "+" in the pop up window

- Under "Tool settings" enter the path to your ANT as "Program", e.g. "C:\apache-ant-1.9.3\bin\ant.bat"

- Under "Parameters" you can enter command line parameters (i.e the targets)

- and finally you can define the path to your build.xml as "Working directory"


Depending on what you check marked as "Show in" the "Name" you defined for this definitions will show up in the selected menus.

If you confirm your settings with "OK", you'll find the new "script" as the last item in the "Before launch" list as "External tool 'name' ".

And you then can select the position where/when your ANT should run.


Then the ant command file will run before every start of a build process or if called from the menues.In a menu you'll find it with the name you assigned.


Good luck!

More Like This

  • Retrieving data ...