Maven IntelliJ
IntelliJ IDEA has built-in support for Maven. In this example we use IntelliJ IDEA Community Edition 11.1.
Some features of IntelliJ IDEA are listed below:
- Maven goals can be run through IntelliJ IDEA.
- You can view Maven command output in IntelliJ IDEA's own terminal.
- You can update Maven dependencies in the IDE.
- You can start a Maven build in IntelliJ IDEA.
- IntelliJ IDEA implements automated dependency management based on Maven's pom.xml.
- IntelliJ IDEA can resolve Maven dependencies through its own workspace without installing them to the local Maven repository, although the dependent projects need to be in the same workspace.
- IntelliJ IDEA can automatically download required dependencies and source code from remote Maven repositories.
- IntelliJ IDEA provides wizards for creating Maven projects and pom.xml files.
Creating a New Project in IntelliJ IDEA
Use the new project wizard to import a Maven project.
- Open IntelliJ IDEA.
- Choice File Menu > New Project option.
-
Choice import project from existing model option.

-
Choice Maven option.

-
Select the project path, i.e., the storage path when a project was created with Maven. Suppose we created a project consumerBanking. Via Maven Building a Java Project see how to create a project with Maven.

-
Select the Maven project to import.

-
Enter the project name and click "finish".

Now we can see the Maven project in IntelliJ IDEA. Look at the Libraries and Test Libraries of the consumerBanking project; you can see that IntelliJ IDEA has added all Maven dependencies to its build path.

Building a Maven Project in IntelliJ IDEA
Now let's use IntelliJ IDEA's compile function to build this Maven project.
- Select the consumerBanking project.
- Choice Buid menu > Rebuild Project option.
You can see the build process output log in IntelliJ IDEA's terminal:
4:01:56 PM Compilation completed successfully
Running the Application in IntelliJ IDEA
- Select the consumerBanking project.
- Right-click App.java to bring up the context menu.
- Choice Run App.main() 。

You will see the following run result in IntelliJ IDEA's terminal:
"C:\Program Files\Java\jdk1.6.0_21\bin\java"
-Didea.launcher.port=7533
"-Didea.launcher.bin.path=
C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 11.1.2\bin"
-Dfile.encoding=UTF-8
-classpath "C:\Program Files\Java\jdk1.6.0_21\jre\lib\charsets.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\deploy.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\javaws.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\jce.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\jsse.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\management-agent.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\plugin.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\resources.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\rt.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\dnsns.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\localedata.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunjce_provider.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunmscapi.jar;
C:\Program Files\Java\jdk1.6.0_21\jre\lib\ext\sunpkcs11.jar
C:\MVN\consumerBanking\target\classes;
C:\Program Files\JetBrains\
IntelliJ IDEA Community Edition 11.1.2\lib\idea_rt.jar"
com.intellij.rt.execution.application.AppMain com.companyname.bank.App
Hello World!
Process finished with exit code 0