javamavenintellij-ideapom.xml

IntelliJ - Convert a Java project/module into a Maven project/module


I have a project on Bitbucket. Only the sources are committed. To retrieve the project onto a new machine, I used Version Control > Checkout from Version Control from within IntelliJ.

It then asks whether I would like to create a new project from this source, to which I reply Yes. So far, so good. It creates a nice little Java project for me, consisting of a single module.

However, my goal in pulling this project into IntelliJ was to turn it into a Maven project. I cannot find any option anywhere that will let me do this!

Is there a way to have IntelliJ just generate a basic empty pom.xml for me, with a name and an artifactId and a repository? Or, is there a way to import the project as a Maven project in the first place? (Whenever I try to create a project from existing source, it only gives me the option of a Java project.)


Solution

  • Right-click on the module, select "Add framework support...", and check the "Maven" technology.

    enter image description here

    enter image description here

    (This also creates a pom.xml for you to modify.)

    If you mean adding source repository elements, I think you need to do that manually–not sure.

    Pre-IntelliJ 13 this won't convert the project to the Maven Standard Directory Layout, 13+ it will.