Maven
From KevinWiki
Contents |
Install
Maven 2 (on Ubuntu Linux 8.04 or higher)
$ sudo apt-get install maven2
Maven 3 (on Ubuntu Linux 12.04 or higher)
$ sudo apt-get install maven
Using Maven2
Create a Project
$ mvn archetype:create -DgroupId=testappgroup -DartifactId=testproject
(The pwd is /home/user/workspace).
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:create] [WARNING] This goal is deprecated. Please use mvn archetype:generate instead [INFO] Defaulting package to group ID: testappgroup [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:RELEASE [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: testappgroup [INFO] Parameter: packageName, Value: testappgroup [INFO] Parameter: package, Value: testappgroup [INFO] Parameter: artifactId, Value: testproject [INFO] Parameter: basedir, Value: /home/user/workspace [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /home/user/workspace/testproject [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Sun Apr 05 19:20:04 EST 2009 [INFO] Final Memory: 16M/242M [INFO] ------------------------------------------------------------------------
or with specifying the version.
$ mvn archetype:create -DgroupId=testappgroup -DartifactId=testproject -Dversion=1.0.0
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:create] [WARNING] This goal is deprecated. Please use mvn archetype:generate instead [INFO] Defaulting package to group ID: testappgroup [INFO] artifact org.apache.maven.archetypes:maven-archetype-quickstart: checking for updates from central [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:RELEASE [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: testappgroup [INFO] Parameter: packageName, Value: testappgroup [INFO] Parameter: package, Value: testappgroup [INFO] Parameter: artifactId, Value: testproject [INFO] Parameter: basedir, Value: /home/user/workspace [INFO] Parameter: version, Value: 1.0.0 [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /home/user/workspace/testproject [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 10 seconds [INFO] Finished at: Mon Apr 06 19:35:56 EST 2009 [INFO] Final Memory: 17M/292M [INFO] ------------------------------------------------------------------------
- Using Archetypes
$ mvn archetype:generate \
-DgroupId=com.domain \
-DartifactId=my-app \
-Dversion=1.0-SNAPSHOT \
-DpackageName=com.domain.myapp \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.0 \
-DinteractiveMode=false
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate] [INFO] Generating project in Batch mode [INFO] Archetype repository missing. Using the one from [org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE] found in catalog internal [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:1.0 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: com.domain [INFO] Parameter: packageName, Value: com.domain [INFO] Parameter: package, Value: com.domain [INFO] Parameter: artifactId, Value: my-app [INFO] Parameter: basedir, Value: /home/user/workspace [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /home/user/workspace/my-app [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Mon Apr 20 21:32:46 EST 2009 [INFO] Final Memory: 16M/242M [INFO] ------------------------------------------------------------------------
Create a Web Project
$ mvn archetype:create -DgroupId=com.domain \ -DartifactId=my-webapp \ -DpackageName=com.domain.myweb \ -DarchetypeArtifactId=maven-archetype-webapp
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:create] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:create] [WARNING] This goal is deprecated. Please use mvn archetype:generate instead [INFO] artifact org.apache.maven.archetypes:maven-archetype-webapp: checking for updates from central [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: maven-archetype-webapp:RELEASE [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: com.domain [INFO] Parameter: packageName, Value: com.domain.myweb [INFO] Parameter: package, Value: com.domain.myweb [INFO] Parameter: artifactId, Value: my-webapp [INFO] Parameter: basedir, Value: /home/user/workspace [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /home/user/workspace/my-webapp [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5 seconds [INFO] Finished at: Mon Apr 20 21:16:46 EST 2009 [INFO] Final Memory: 16M/242M [INFO] ------------------------------------------------------------------------
- Using Archetypes
$ mvn archetype:generate \
-DgroupId=com.domain \
-DartifactId=my-webapp \
-Dversion=1.0-SNAPSHOT \
-DpackageName=com.domain.myweb \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-webapp \
-DarchetypeVersion=1.0 \
-DinteractiveMode=false
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate] [INFO] Generating project in Batch mode [INFO] Archetype repository missing. Using the one from [org.apache.maven.archetypes:maven-archetype-webapp:RELEASE] found in catalog internal [INFO] ---------------------------------------------------------------------------- [INFO] Using following parameters for creating OldArchetype: maven-archetype-webapp:1.0 [INFO] ---------------------------------------------------------------------------- [INFO] Parameter: groupId, Value: com.domain [INFO] Parameter: packageName, Value: com.domain [INFO] Parameter: package, Value: com.domain [INFO] Parameter: artifactId, Value: my-webapp [INFO] Parameter: basedir, Value: /home/user/workspace [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] ********************* End of debug info from resources from generated POM *********************** [INFO] OldArchetype created in dir: /home/user/workspace/my-webapp [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Mon Apr 20 21:25:26 EST 2009 [INFO] Final Memory: 17M/292M [INFO] ------------------------------------------------------------------------
Maven Lifecycle
Build a Project
Integration with Eclipse
Add Maven Repository Info
-Add the Maven repository info to the Eclipse workspace.
- Close Eclipse if it is running
- Open the terminal and type the following command.
$ mvn -Declipse.workspace=/home/user/workspace eclipse:add-maven-repo
(Don't use ~ for home directory).
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [eclipse:add-maven-repo] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] [eclipse:add-maven-repo] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Sun Apr 05 16:37:42 EST 2009 [INFO] Final Memory: 16M/292M [INFO] ------------------------------------------------------------------------
- Then
M2_REPO
can be found from
Preferences -> Java -> Classpath Variables
- If the mvn command is executed while Eclipse is running, restart the Eclipse.
Add Eclipse Metadata to Non-Eclipse Project
- Move to the project and run the
maven eclipse:eclipse
$ cd /home/user/workspace/testproject $ mvn eclipse:eclipse
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] ------------------------------------------------------------------------ [INFO] Building testproject [INFO] task-segment: [eclipse:eclipse] [INFO] ------------------------------------------------------------------------ [INFO] Preparing eclipse:eclipse [INFO] No goals needed for project - skipping [INFO] [eclipse:eclipse] [INFO] Using Eclipse Workspace: /home/user/workspace [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER [INFO] Not writing settings - defaults suffice [INFO] Wrote Eclipse project for "testproject" to /home/user/workspace/testproject. [INFO] Sources for some artifacts are not available. Please run the same goal with the -DdownloadSources=true parameter in order to check remote repositories for sources. List of artifacts without a source archive: o junit:junit:3.8.1 Javadoc for some artifacts is not available. Please run the same goal with the -DdownloadJavadocs=true parameter in order to check remote repositories for javadoc. List of artifacts without a javadoc archive: o junit:junit:3.8.1 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Sun Apr 05 19:56:21 EST 2009 [INFO] Final Memory: 16M/243M [INFO] ------------------------------------------------------------------------
- To download the source code and the javadoc of the junit mentioned above, run the following command.
(Optional)
$ mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true
- Result
[INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'eclipse'. [INFO] ------------------------------------------------------------------------ [INFO] Building testproject [INFO] task-segment: [eclipse:eclipse] [INFO] ------------------------------------------------------------------------ [INFO] Preparing eclipse:eclipse [INFO] No goals needed for project - skipping [INFO] [eclipse:eclipse] [INFO] Using Eclipse Workspace: /home/user/workspace [INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAINER [INFO] Not writing settings - defaults suffice [INFO] Wrote Eclipse project for "testproject" to /home/user/workspace/testproject. [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Sun Apr 05 20:06:13 EST 2009 [INFO] Final Memory: 17M/292M [INFO] ------------------------------------------------------------------------
- Now, the project can be imported as an existing Eclipse project with 'Import' function on Eclipse (Chose
Existing Projects into Workspace
).
The Project Object Model (POM)
groupId
- An identifier for the group, team, company, project or organisation. The convention for this is the name beginning with the reverse domain name of the organisation which develops the project. (e.g.
com.lckymn
)
artifactId
- An identifier of a single project belongs the the
groupId
version
- The version identifier of the project release. The project in active development stage can use a special ID which is a
SNAPSHOT
(e.g. 1.1.1-SNAPSHOT).
- There cannot be more than one project with the same three
groupId
,artifactId
andversion
identifiers.
packaging
Examples
<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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.lckymn.kevin</groupId> <artifactId>test-app</artifactId> <packaging>war</packaging> <name>Test Webapp</name> <version>0.0.1-SNAPSHOT</version> <description></description> <repositories> <repository> <id>jboss</id> <url>http://repository.jboss.com/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>jboss-snapshot</id> <url>http://snapshots.jboss.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>com.springsource.repository.bundles.release</id> <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name> <url>http://repository.springsource.com/maven/bundles/release</url> </repository> <repository> <id>com.springsource.repository.bundles.external</id> <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name> <url>http://repository.springsource.com/maven/bundles/external</url> </repository> <repository> <id>com.springsource.repository.bundles.milestone</id> <name>SpringSource Enterprise Bundle Repository - External Bundle Milestones</name> <url>http://repository.springsource.com/maven/bundles/milestone</url> </repository> <!-- <repository>--> <!-- <id>apache maven repository</id>--> <!-- <url>http://www.ibiblio.org/maven/</url>--> <!-- </repository>--> <!-- <repository> <id>com.springsource.repository.bundles.snapshot</id> <name>SpringSource Enterprise Bundle Repository - Nightly Snapshots</name> <url> http://repository.springsource.com/maven/bundles/snapshot</url> </repository> --> </repositories> <pluginRepositories> <pluginRepository> <id>jboss-plugins</id> <url>http://repository.jboss.com/maven2</url> </pluginRepository> </pluginRepositories> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.0</version> <scope>compile</scope> </dependency> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.0</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.6</version> <scope>test</scope> </dependency> <dependency> <groupId>jfree</groupId> <artifactId>jcommon</artifactId> <version>1.0.14</version> <type>jar</type> <scope>compile</scope> <exclusions> <exclusion> <artifactId>gnujaxp</artifactId> <groupId>gnujaxp</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> <version>1.0.11</version> <type>jar</type> <scope>compile</scope> <exclusions> <exclusion> <artifactId>gnujaxp</artifactId> <groupId>gnujaxp</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>net.sf.opencsv</groupId> <artifactId>opencsv</artifactId> <version>1.8</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> <version>1.3.2</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.log4j</groupId> <artifactId>com.springsource.org.apache.log4j</artifactId> <version>1.2.15</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>com.springsource.javax.mail</artifactId> <version>1.4.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>3.3.2.GA</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-c3p0</artifactId> <version>3.3.2.GA</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>3.4.0.GA</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.5.8</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>2.5.6.SEC01</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>2.5.6.SEC01</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-dao</artifactId> <version>2.0.8</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>${spring.version}</version> <type>jar</type> <scope>compile</scope> </dependency> <dependency> <groupId>org.codehaus.xfire</groupId> <artifactId>xfire-jaxws</artifactId> <version>1.2.6</version> <exclusions> <exclusion> <artifactId>spring</artifactId> <groupId>org.springframework</groupId> </exclusion> <exclusion> <artifactId>xalan</artifactId> <groupId>xalan</groupId> </exclusion> <exclusion> <artifactId>xercesImpl</artifactId> <groupId>xerces</groupId> </exclusion> <exclusion> <artifactId>jaxb-impl</artifactId> <groupId>com.sun.xml.bind</groupId> </exclusion> <exclusion> <artifactId>jaxb-xjc</artifactId> <groupId>com.sun.xml.bind</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>2.5.6.SEC01</version> <type>jar</type> <scope>compile</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>${java.version}<//source> <target>${java.version}</target> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.2</version> <dependencies> <!-- Maven 2.0.9 or above--> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <verbose>true</verbose> <source>${java.version}<//source> <target>${java.version}</target> <compliancelevel>${java.version}</compliancelevel> <encoding>UTF-8</encoding> <!-- <includes>--> <!-- <include>**/*.aj</include>--> <!-- </includes>--> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <!-- WARNING: Do not use 2.6 or above due to http://jira.codehaus.org/browse/MECLIPSE-538 --> <version>2.7</version> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>false</downloadJavadocs> <Buildcommands> <buildCommand> <name>org.eclipse.ajdt.core.ajbuilder</name> <!-- <arguments>--> <!-- <aspectPath>com.lckymn.kevin.web.contoller</aspectPath>--> <!-- </arguments>--> </buildCommand> <buildCommand> <name>org.springframework.ide.eclipse.core.springbuilder</name> </buildCommand> </Buildcommands> <additionalProjectnatures> <projectnature>org.eclipse.ajdt.ui.ajnature</projectnature> <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> </additionalProjectnatures> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-idea-plugin</artifactId> <version>2.2</version> <configuration> <downloadSources>true</downloadSources> <downloadJavadocs>false</downloadJavadocs> <dependenciesAsLibraries>true</dependenciesAsLibraries> <useFullNames>false</useFullNames> </configuration> </plugin> <!-- generate report --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.3</version> <inherited>true</inherited> <configuration> <forkMode>always</forkMode> <reportFormat>xml</reportFormat> <classesDirectory>${project.build.directory}/generated-classes/emma/classes</classesDirectory> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-2</version> <inherited>true</inherited> <executions> <execution> <id>instrument</id> <phase>process-classes</phase> <goals> <goal>instrument</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-report-plugin</artifactId> <version>2.4.3</version> </plugin> </plugins> <finalName>test-app</finalName> </build> <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>emma-maven-plugin</artifactId> <version>1.0-alpha-2</version> <inherited>true</inherited> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>surefire-report-maven-plugin</artifactId> <version>2.0-beta-1</version> <inherited>true</inherited> </plugin> </plugins> </reporting> <properties> <java.version>1.6</java.version> <spring.version>2.5.6.SEC01</spring.version> <aspectj.version>1.6.5</aspectj.version> </properties> </project>