- Maven Module
For the Maven projects IntelliJ IDEA provides a dedicated module type. For each Maven Module, IntelliJ IDEA creates a pom.xml file. So doing, a Maven Module can be created either with the basic pom.xml file, or from a certain pattern called Maven archetype.
The dedicated module type allows creating Maven projects that have parent and aggregator Maven projects.
- Maven repositories
IntelliJ IDEA enables communication with remote Maven repositories, and maintaining the local ones.
When Maven goals are executed in the IDE, IntelliJ IDEA is aware of all downloads and artifacts. However, if you launch Maven from command line, the artifacts produced come unnoticed, and you have to make IntelliJ IDEA search for updates. For this purpose, IntelliJ IDEA suggests a quick fix to update indices, and a node in the Settings dialog (Maven | Repository Indices).
In particular, updating indices helps keep the list of available Maven archetypes up to date.
Maven works with pom.xml files to build projects. At minimum, a pom.xml file should contain a root element <project>, and identifiers of the project group, artifact and version.
IntelliJ IDEA supports syntax of the pom.xml files. When editing pom.xml files, you can enjoy the following advanced editing features:
- Syntax highlighting.
- 9.0+Maven dependencies and parent generation using Alt+InsertCommand N; Command Enter.
- 9.0+Quick fixes for adding dependencies and updating Maven indices.
- Code completion.
- 9.0+ Navigation between modules and pom.xml dependencies (Ctrl+BCtrl+B), on a property from pom.xml files, settings.xml and profiles.xml files, system and environment properties, and properties defined in custom Maven filters.
- Structure view.
- 9.0+Find Usages (Ctrl+F7Ctrl+F7 ).
- Code folding.
- 9.0+Rename refactoring for properties defined in Maven project and custom filters files.
- Viewing parameter information Ctrl+PCommand P.
- Viewing quick info GuiDesigner.QuickJavadocGuiDesigner.QuickJavadoc.
- Import of Maven projects
If you want to use an existing Maven project, you can import it directly by opening its pom.xml file. When a Maven project is imported, it maps to an IntelliJ IDEA module with the name, which is equal to the Maven project's artifactId. Dependencies between the Maven projects map to the dependencies of IntelliJ IDEA modules from the libraries and other modules. IntelliJ IDEA analyzes the pom.xml file and automatically downloads the necessary dependencies.
- Maven Projects tool window
The dedicated Maven Projects tool window allows you to manage Maven projects, configure preferences for the current Maven project and the defaults for the new ones, and execute Maven goals. Results are displayed in the Maven Build Output window.
- Running and debugging Maven goals
IntelliJ IDEA provides two ways of running the Maven goals:
- Create run/debug configuration and launch it.
- Use the Run Maven Build command in the Maven Projects tool window. This way doesn’t require any run/debug configuration.
IntelliJ IDEA's Make features are capable of filtering Maven resources. However, IntelliJ IDEA yet does not support filtering web resources.
Details on configuring filter options within the pom.xml can be found at http://maven.apache.org/plugins/maven-resources-plugin/.9.0+
Note, that classpath for Maven-based projects is built following the Maven rules. IntelliJ IDEA supports compile, test and run-time dependency scopes.
- WAR overlays
IntelliJ IDEA Maven integration correctly handles WAR overlays, which is important for the Web projects that use common resources defined in a WAR module. IntelliJ IDEA unpacks such WAR to the overlays directory under the content root of the dependent Maven Module.
- Dependency Graph
IntelliJ IDEA provides you with a handy graph-view of Maven dependencies available from the context menu in the Maven Projects tool window.