Tips & Tricks

Opening Maven Projects is Easy as Pie

Maven integration in a Java IDE might not be a surprise for you, but let me show you just one thing, that makes IntelliJ IDEA Maven support prominent and noteworthy.

If you have any Maven project, you do not need to perform routine steps while importing it to IntelliJ IDEA and you do not need to be anxious about dependencies and artifacts in it, nor would you need to worry about technologies used in project. Just open the project as you do with usual IntelliJ IDEA projects, sit back and relax. IntelliJ IDEA will automatically recognize everything.

Here is an example. To open our Maven project, we just go to File | Open Project (Alt + F + O) and specify the path to pom.xml (the Maven project descriptor file).

Select Path dialog

IntelliJ IDEA creates a project based on the Maven Project descriptor file.
When done, all maven goals can be found in the Maven projects tool window. We can simply run/debug arbitrary Maven goals; execute them before/after make or run/debug, or by invoking an assigned keyboard shortcut. Select any Maven goal in the tree and right-click it to view options.

Run Maven Goal

Now, let’s view our project structure. Go to Settings (Ctrl + Alt + S) | Project Structure and click Modules. As you can see, IntelliJ IDEA recognized modules and web facets. Moreover, all dependencies and deployment settings were detected and stored.

Facet

That’s all, nothing but a single click and you can enjoy complete support for Maven builder, including smart coding assistance for editing Maven pom.xml, intelligent code completion, inspections and quick-fixes, refactorings and other IntelliJ IDEA productivity-boosting features, which we are going to cover in the next posts.

Technorati tags: IntelliJ IDEA, IntelliJ, Maven
image description