Is there a way to automate the setup of IntelliJ projects


I have the problem, that the software at my work consists of many individual components and libraries. All of them need to be checked out of svn/git first, then imported as maven modules. Since we work with many branches, this takes a lot of time, each time a new branch of every project/component is created.

Is there a way/plugin/script language, so I can automate the import of all maven projects as "new maven module from existing sources" in IntelliJ?

On the filesystem I have the following situation,


and I like to have one workspace with all modules auto-imported.






Hello Dennis,

The quickest solution would probably be to:

  • Create a new empty Maven project; it will serve as an aggregator (e.g. /home/den/projects/maven_aggr)
  • Check out your component/lib projects into the aggregator project's root folder (e.g. /home/den/projects/maven_aggr/projectA)
  • Open the aggregator project in IDEA, observe you projects added as simple directories. Navigate to each subproject's pom.xml, right-click on it and select the 'Add as Maven Project' option (next to the very end of the context menu)
  • Wait for the subproject to be re-imported as a Maven module

One other thing. There's a file called misc.xml in the .idea default project directory. It contains various project config related data, including the information about a project's modules. You can try including it into each branch checkout so that this information is preserved.

You can also vote for the following issues:

See this article if you are not familiar with YouTrack.


Hi Arina,

thanks for your answer. The option with the aggregator project is better than really importing everything by hand. What unfortunately doesn't work this way is that you can't have one Maven project imported in multiple workspaces.


Workspace 1:
Component 1

Workspace 2:
Component 2
Library 3

Would it be possible to control the maven import via command line or is there a custom plugin api method to import a maven project as module without any dialog appearing?


Hi Dennis. 

Answering you direct questions:
Yes, of course u can create a plugin for this. Please look at documentation, also see - our slack support channel for plugin developers

You can use ProjectUtil.openOrImport methods to open maven project as a new project

Also, you can look at MavenImportWizardTest.testImportModule to see how you can import module without any dialog.

Also you can create a feature request here

Going deeper

I assume that you used eclipse before, right?
Could you please share your experience, how do you want to open module from existing sources. Is getting rid of wizard window (Import module) will be enough for you? Or I missed something?




yes it would be sufficient if you could select multiple parent pom files from different directories and then import them all with the default Maven import settings or that the import dialog comes only once and then all projects are imported with these settings.