Create a software project and modules programmatically

I have a large project with many large directory structures. They produce about 90 JAR. The structure of the IntelliJ project does not coincide (or similar) with what is seen in the Ant scripts. This creates a lot of problems when editing code. The main side effect is the addition of invalid dependencies. Essentially, I want to create a one-dimensional one-module display

Is it possible to programmatically create Intellij modules? I can reuse an existing library set created in IntelliJ

+4
source share
2 answers

@CrazyCoder is right, using maven would be the best solution, but this conversation might just be too big to grasp.

.iml files are just xml and, although not documented, they are pretty straightforward. You should not create a template and then use the ant property replacement or custom task to create these files for each module.

For reference, you can look at the source maven-idea-plug , it generates .iml files for the maven project, and you can provide a hint on how to do this with ant. Please note that @CrazyCoder points out comments that should only be a link ... do not use this to support maven in Idea.

+4
source

Please use instead of Maven or Gradle, IDEA supports both. Maven support is more mature, Gradle support will improve in future updates.

Your Maven projects will work with all the major IDEs and the command line, not just IntelliJ IDEA.

+5
source

Source: https://habr.com/ru/post/1394396/


All Articles