About

Home‎ > ‎Eclipse‎ > ‎

Setting up Maven2 with Eclipse

This page describes common tasks usually done for a new project setup for Maven2 in eclipse.

Install Maven2 Eclipse (m2eclipse) Plugin

You could install the plugin from here.

Add project nature(s) and builder(s)

The procedure is described here. At the minimum add Maven2 project nature.

Just add following configuration to maven-eclipse-plugin.
<configuration>
    <additionalProjectnatures>
        <projectnature>org.maven.ide.eclipse.maven2Nature</projectnature>
    </additionalProjectnatures>
    <additionalBuildcommands>
        <buildcommand>org.maven.ide.eclipse.maven2Builder</buildcommand>
    </additionalBuildcommands>
</configuration>
To view all options go to Maven website. Navigate to Documentation > Maven Plugins > Eclipse > Goals > 'eclipse:eclipse'

Commonly used natures and builders

Spring
org.springframework.ide.eclipse.core.springbuilder
org.springframework.ide.eclipse.core.springnature
Maven
org.maven.ide.eclipse.maven2Builder
org.maven.ide.eclipse.maven2Nature
Checkstyle
com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder
com.atlassw.tools.eclipse.checkstyle.CheckstyleNature

Clean up old eclipse config files and create a new ones

Run maven goals 'eclipse:clean' and 'eclipse:eclipse'.
Command:
mvn eclipse:clean eclipse:eclipse

Setting up source and target JDK

Just add following configuration to maven-compiler-plugin.

<configuration>
    <source>1.6</source>
    <target>1.6</target>
</configuration>


Comments