Mike S
Mike S

Reputation: 11419

How to import existing Ant build.xml into IntelliJ IDEA

I have an existing project that uses an Ant build.xml file to maintain the location of dependency jars.

In Eclipse it's very easy to import from an existing Ant file. I have searched online and looked through all of the "new project" options in IntelliJ but cannot figure out how to do this.

The closest thing I've done is File > New > Project from Existing Sources. But my whole project is full of errors because it didn't use the build.xml to include the jars.

Upvotes: 27

Views: 47191

Answers (4)

Arefe
Arefe

Reputation: 12431

Please, follow the steps below if you use the IntellIj:

  1. Check the Ant plugin for the project.

enter image description here

  1. select the build.xml file and add as the Ant build file

enter image description here

  1. Use the side button to deploy the project

enter image description here

Upvotes: 3

matanox
matanox

Reputation: 13716

Import the project "from existing sources" without choosing any build tool (ant is not on the list, only maven, sbt, etc...). Then after completing the import wizard, in the project files view, right click ant's build.xml file, and choose the option relating to ant which is hiding at the bottom of the menu.

Upvotes: 12

Amir Razmjou
Amir Razmjou

Reputation: 597

You should use File > New > Module instead of File > New > Project from Existing Sources for Ant project. You also need to set your Content root and Module file location to your current Ant project directory.

You may also need to set right path to project output in Project Structure > Use module compile output path and set proper content route in Project Structure > Sources

Upvotes: 12

hitz
hitz

Reputation: 1110

Intellij supports Ant projects via built in Ant plugin which is included by default in IDE. To check if it is enabled go to Settings > Plugins > Ant

After enabling plugin, you can use build.xml from View > Tool Windows > Ant Build

You should then have option(+) of importing your build.xml file.

Upvotes: 19

Related Questions