简体   繁体   中英

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.

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.

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

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.

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

  1. Check the Ant plugin for the project.

在此处输入图片说明

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

在此处输入图片说明

  1. Use the side button to deploy the project

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM