This tutorial shows how to convert the current java project to a maven project opened in Intelli IDEA.

We can create new java, maven, or kotlin projects directly or can import existing applications into IntelliJ IDEA.

Maven project contains dependency configuration in pom.xml.

You can do manually convert the java project to maven project using the below steps

  • Add the pom.xml to the java project root folder.
  • It is very difficult to add dependencies without color syntax

IntelliJ IDEA provides inbuilt support from normal java project into maven project and creates pom.xml and move the folders and support for adding dependencies.

How to Convert java project to maven project in Intelli IDEA editor.

  • Open java project in Intelli IDEA
  • right-click on the project, It shows the context menu
  • Select Add to Framework Support options
  • It opens the Add to Framework Support window
  • Select and check Maven in this window.

You can see both the above steps in the below window

Intellij convert java to maven project

  • It adds pom.xml with default values.
  <?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>groupId</groupId>
    <artifactId>javacode</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>

</project>
  • You can change the groupid,artifactId, and version manually.
  • Also, add dependencies manually.

Similarly, This is another way of converting a java project to a maven project.

Select File > New > Project from Existing Sources and follow the steps to give groupid, artifactId, and version details