Billz
Billz

Reputation: 8105

How do you "Mavenize" a project using Intellij?

I have seen many posts about using eclipse to Mavenize a project. Is there a easy way to do that in IntelliJ? From what I understand about "Mavenize", it's just add some xml in pom.xml and the directory structure is in src/main/java, src/main/test ....

Upvotes: 61

Views: 53231

Answers (6)

WesternGun
WesternGun

Reputation: 12728

Now, even adding Framework support I cannot auto-generate the structure of Maven project (src/main/java, src/test/java, etc.).

But, Intellij has a fallback: right click the project, "New" - "Folder", you will see those 4 dirs as hints. Just select them and they are generated following the convention. Kind of automated. I am satisfied already.

Here I only have 3 because I don't want to delete my src/main/java. But at first there were 4. You get the idea.

enter image description here

Upvotes: 0

Du-Lacoste
Du-Lacoste

Reputation: 12767

Following steps will help you to add maven support for your project.

  1. Right click on the module
  2. Select Add Framework Support
  3. Select Maven from the options on the left and click OK

Now the IDEA will create a default pom.xml to the project selected and creates standard maven project structure.

Open the created pom.xml file and edit the groupId, artifactId and version as per your requirement since the values will be automatically created when converted to maven project.

Afterwards, dependencies can be added into the pom.xml. Every time you change the POM, IntelliJ IDEA displays a popup suggesting to import your changes. You can look here to enable/ disable auto import if you prefer.

Upvotes: 0

Victor
Victor

Reputation: 781

Right-click on the module, select "Add framework support...", and check the "Maven" technology. (This also creates a pom.xml for you to modify.)

Upvotes: 5

kgui
kgui

Reputation: 4165

For those that benefit from a visual, as I did:

enter image description here

Essentially, just right-click on the folder. In this example, it's called StackOverFlow and choose Add Framework Support and then check the Maven box. Please note, that this option only exists when you have created a class within the src folder.

Upvotes: 108

Manto
Manto

Reputation: 1117

Go to .iml and in the component change the tag to the following

<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">

Upvotes: 2

vishvAs vAsuki
vishvAs vAsuki

Reputation: 3117

This works in 2016.3.1 version: Right click on project -> go to the Maven menu -> show effective POM

Upvotes: 0

Related Questions