How do I build my project?
Author: Deron Eriksson
Description: This tutorial describes how to build a maven project.
Tutorial created using: Windows Vista || JDK 1.6.0_04 || Eclipse Web Tools Platform 2.0.1 (Eclipse 3.3.1)


Page: < 1 2

(Continued from page 1)

The "mvn package" command executed, and the following results were displayed to the console:

Console output from executing package goal

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building mytest
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test]
[INFO] Surefire report directory: C:\dev\workspace\mytest\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running com.maventest.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.037 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] [jar:jar]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Fri Feb 01 16:15:04 PST 2008
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------

The phases of the mavenSW lifecycle leading up to and including the package phase are displayed in the console output. We can see that the various phases occur, such as the test phase where one unit test is run. At the end, we see that the jar:jar goal is run for the package phase, which builds the jarW file. If we now examine the mytest project after it has been refreshed, we can see that the mytest-1.0-SNAPSHOT.jar file has been built in the target directory.

mytest-1.0-SNAPSHOT.jar has been built

Notice that the name of the jar file (mytest-1.0-SNAPSHOT.jar) is the artifactId (mytest) followed by the version (1.0-SNAPSHOT).

Page: < 1 2