You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/02/12 09:53:00 UTC
svn commit: r1243212 - in
/maven/site/trunk/src/site/apt/guides/getting-started: index.apt
maven-in-five-minutes.apt
Author: hboutemy
Date: Sun Feb 12 08:52:59 2012
New Revision: 1243212
URL: http://svn.apache.org/viewvc?rev=1243212&view=rev
Log:
improved rendering
Modified:
maven/site/trunk/src/site/apt/guides/getting-started/index.apt
maven/site/trunk/src/site/apt/guides/getting-started/maven-in-five-minutes.apt
Modified: maven/site/trunk/src/site/apt/guides/getting-started/index.apt
URL: http://svn.apache.org/viewvc/maven/site/trunk/src/site/apt/guides/getting-started/index.apt?rev=1243212&r1=1243211&r2=1243212&view=diff
==============================================================================
--- maven/site/trunk/src/site/apt/guides/getting-started/index.apt (original)
+++ maven/site/trunk/src/site/apt/guides/getting-started/index.apt Sun Feb 12 08:52:59 2012
@@ -111,7 +111,6 @@ Sections
the command line:
+-----+
-
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DgroupId=com.mycompany.app \
@@ -143,7 +142,6 @@ mvn archetype:generate \
</dependency>
</dependencies>
</project>
-
+-----+
<<<pom.xml>>> contains the Project Object Model (POM) for this project. The POM is the basic unit
@@ -201,7 +199,6 @@ mvn archetype:generate \
has been created:
+-----+
-
my-app
|-- pom.xml
`-- src
@@ -217,7 +214,6 @@ my-app
`-- mycompany
`-- app
`-- AppTest.java
-
+-----+
As you can see, the project created from the archetype has a POM, a source tree for your application's sources and
@@ -237,15 +233,12 @@ my-app
your application sources:
+-----+
-
mvn compile
-
+-----+
Upon executing this command you should see output like the following:
+-----+
-
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO] task-segment: [compile]
@@ -267,7 +260,6 @@ Compiling 1 source file to <dir>/my-app/
[INFO] Finished at: Fri Sep 23 15:48:34 GMT-05:00 2005
[INFO] Final Memory: 2M/6M
[INFO] ----------------------------------------------------------------------------
-
+-----+
The first time you execute this (or any other) command, Maven will need to download all the plugins and related
@@ -293,15 +285,12 @@ Compiling 1 source file to <dir>/my-app/
Execute the following command:
+----+
-
mvn test
-
+----+
Upon executing this command you should see output like the following:
+----+
-
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO] task-segment: [test]
@@ -348,9 +337,7 @@ Results :
If you simply want to compile your test sources (but not execute the tests), you can execute the following:
+----+
-
mvn test-compile
-
+----+
Now that you can compile your application sources, compile your tests, and execute the tests, you'll want to move
@@ -363,9 +350,7 @@ Results :
~~ How to skip tests ... jvz
+----+
-
mvn package
-
+----+
If you take a look at the POM for your project you will notice the <<<packaging>>> element is set to <<<jar>>>.
@@ -378,15 +363,12 @@ mvn package
To do so execute the following command:
+----+
-
mvn install
-
+----+
Upon executing this command you should see the following output:
+----+
-
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Quick Start Archetype
[INFO] task-segment: [install]
@@ -421,7 +403,6 @@ Results :
[INFO] Finished at: Tue Oct 04 13:20:32 GMT-05:00 2005
[INFO] Final Memory: 3M/8M
[INFO] ----------------------------------------------------------------------------
-
+----+
Note that the surefire plugin (which executes the test) looks for tests contained in files with a particular naming convention. By default
@@ -458,17 +439,13 @@ Results :
time all you need to do to provide basic information about your project is execute the following command:
+----+
-
mvn site
-
+----+
There are plenty of other standalone goals that can be executed as well, for example:
+----+
-
mvn clean
-
+----+
This will remove the <<<target>>> directory with all the build data before starting so that it is fresh.
@@ -476,9 +453,7 @@ mvn clean
Perhaps you'd like to generate an IntelliJ IDEA descriptor for the project?
+----+
-
mvn idea:idea
-
+----+
This can be run over the top of a previous IDEA project - it will update the settings rather than starting fresh.
@@ -486,9 +461,7 @@ mvn idea:idea
If you are using Eclipse IDE, just call:
+----+
-
mvn eclipse:eclipse
-
+----+
~~TODO: need a sidebar notation for notes like this
@@ -553,7 +526,6 @@ mvn eclipse:eclipse
structure starting at the base of the JAR.
+----+
-
my-app
|-- pom.xml
`-- src
@@ -579,7 +551,6 @@ my-app
see the following:
+----+
-
|-- META-INF
| |-- MANIFEST.MF
| |-- application.properties
@@ -592,7 +563,6 @@ my-app
`-- mycompany
`-- app
`-- App.class
-
+----+
As you can see, the contents of <<<$\{basedir\}/src/main/resources>>> can be found starting at the base of the
@@ -607,13 +577,11 @@ my-app
Java API and look like the following:
+----+
-
#Generated by Maven
#Tue Oct 04 15:43:21 GMT-05:00 2005
version=1.0-SNAPSHOT
groupId=com.mycompany.app
artifactId=my-app
-
+----+
To add resources to the classpath for your unit tests, you follow the same pattern as you do for adding resources to the JAR
@@ -621,7 +589,6 @@ artifactId=my-app
project directory structure that would look like the following:
+---+
-
my-app
|-- pom.xml
`-- src
@@ -648,7 +615,6 @@ my-app
testing:
+----+
-
...
// Retrieve resource
@@ -657,7 +623,6 @@ InputStream is = getClass().getResourceA
// Do something with the resource
...
-
+----+
* {How do I filter resource files?}
@@ -667,21 +632,23 @@ InputStream is = getClass().getResourceA
The property can be one of the values defined in your pom.xml, a value defined in the user's settings.xml, a property
defined in an external properties file, or a system property.
- To have Maven filter resources when copying, simply set <<<filtering>>> to true for the resource directory in your pom.xml:
+ To have Maven filter resources when copying, simply set <<<filtering>>> to true for the resource directory in your <<<pom.xml>>>:
+----+
-
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -690,6 +657,7 @@ InputStream is = getClass().getResourceA
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<resources>
<resource>
@@ -699,7 +667,6 @@ InputStream is = getClass().getResourceA
</resources>
</build>
</project>
-
+----+
You'll notice that we had to add the <<<build>>>, <<<resources>>>, and <<<resource>>> elements which weren't there before.
@@ -719,40 +686,32 @@ InputStream is = getClass().getResourceA
src/main/resources directory) whose values will be supplied when the resource is filtered:
+----+
-
# application.properties
application.name=${pom.name}
application.version=${pom.version}
-
+----+
With that in place, you can execute the following command (process-resources is the build lifecycle phase where the resources are
copied and filtered):
+----+
-
mvn process-resources
-
+----+
and the application.properties file under target/classes (and will eventually go into the jar) looks like this:
+----+
-
# application.properties
application.name=Maven Quick Start Archetype
application.version=1.0-SNAPSHOT
-
+----+
To reference a property defined in an external file, all you need to do is add a reference to this external file in your pom.xml.
First, let's create our external properties file and call it src/main/filters/filter.properties:
+----+
-
# filter.properties
my.filter.value=hello!
-
+----+
Next, we'll add a reference to this new file in the pom.xml:
@@ -763,12 +722,15 @@ my.filter.value=hello!
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -777,6 +739,7 @@ my.filter.value=hello!
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<filters>
<filter>src/main/filters/filter.properties</filter>
@@ -789,23 +752,20 @@ my.filter.value=hello!
</resources>
</build>
</project>
-
+----+
Then, if we add a reference to this property in the application.properties file:
+----+
-
# application.properties
application.name=${pom.name}
application.version=${pom.version}
message=${my.filter.value}
-
+----+
- the next execution of the <<<mvn process-resources>>> command will put our new property value into application.properties.
+ the next execution of the <<<mvn process-resources>>> command will put our new property value into <<<application.properties>>>.
As an alternative to defining the my.filter.value property in an external file, you could also have defined it in the <<<properties>>>
- section of your pom.xml and you'd get the same effect (notice I don't need the references to src/main/filters/filter.properties either):
+ section of your pom.xml and you'd get the same effect (notice I don't need the references to <<<src/main/filters/filter.properties>>> either):
+----+
<project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -813,12 +773,15 @@ message=${my.filter.value}
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -827,6 +790,7 @@ message=${my.filter.value}
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<resources>
<resource>
@@ -835,11 +799,11 @@ message=${my.filter.value}
</resource>
</resources>
</build>
+
<properties>
<my.filter.value>hello</my.filter.value>
</properties>
</project>
-
+----+
Filtering resources can also get values from system properties; either the system properties built into Java (like java.version or
@@ -847,20 +811,16 @@ message=${my.filter.value}
our application.properties file to look like this:
+----+
-
# application.properties
java.version=${java.version}
command.line.prop=${command.line.prop}
-
+----+
Now, when you execute the following command (note the definition of the command.line.prop property on the command line), the
application.properties file will contain the values from the system properties.
+----+
-
mvn process-resources "-Dcommand.line.prop=hello again"
-
+----+
@@ -881,12 +841,15 @@ mvn process-resources "-Dcommand.line.pr
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -896,7 +859,6 @@ mvn process-resources "-Dcommand.line.pr
</dependency>
</dependencies>
</project>
-
+----+
For each external dependency, you'll need to define at least 4 things: groupId, artifactId, version, and scope. The groupId,
@@ -931,7 +893,6 @@ mvn process-resources "-Dcommand.line.pr
</dependency>
</dependencies>
</project>
-
+----+
What about dependencies built somewhere else? How do they get into my local repository? Whenever a project references a dependency
@@ -949,7 +910,6 @@ mvn process-resources "-Dcommand.line.pr
log4j looks like:
+----+
-
<metadata>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@@ -968,7 +928,6 @@ mvn process-resources "-Dcommand.line.pr
</versions>
</versioning>
</metadata>
-
+----+
From this file, we can see that the groupId we want is "log4j" and the artifactId is "log4j". We see lots of different version values
@@ -987,12 +946,15 @@ mvn process-resources "-Dcommand.line.pr
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -1008,7 +970,6 @@ mvn process-resources "-Dcommand.line.pr
</dependency>
</dependencies>
</project>
-
+----+
Now, when we compile the project (<<<mvn compile>>>), we'll see Maven download the log4j dependency for us.
@@ -1023,18 +984,20 @@ mvn process-resources "-Dcommand.line.pr
Here is an example using scp and username/password authentication:
+----+
-
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -1048,6 +1011,7 @@ mvn process-resources "-Dcommand.line.pr
<version>1.0.4</version>
</dependency>
</dependencies>
+
<build>
<filters>
<filter>src/main/filters/filters.properties</filter>
@@ -1072,7 +1036,6 @@ mvn process-resources "-Dcommand.line.pr
</repository>
</distributionManagement>
</project>
-
+----+
+----+
@@ -1092,7 +1055,6 @@ mvn process-resources "-Dcommand.line.pr
</servers>
...
</settings>
-
+----+
Note that if you are connecting to an openssh ssh server which has the parameter "PasswordAuthentication" set to "no"
@@ -1108,13 +1070,11 @@ mvn process-resources "-Dcommand.line.pr
for your existing project using the following command:
+----+
-
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-site \
-DgroupId=com.mycompany.app \
-DartifactId=my-app-site
-
+----+
Now head on over to the {{{../mini/guide-site.html}Guide to creating a site}}
@@ -1125,27 +1085,29 @@ mvn archetype:generate \
Note that the lifecycle applies to any project type. For example, back in the base directory we can create a
simple web application:
--------------------
++----+
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-webapp \
-DgroupId=com.mycompany.app \
-DartifactId=my-webapp
--------------------
++----+
Note that these must all be on a single line. This will create a directory called
<<<my-webapp>>> containing the following project descriptor:
--------------------
++----+
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-webapp</artifactId>
- <packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -1154,18 +1116,19 @@ mvn archetype:generate \
<scope>test</scope>
</dependency>
</dependencies>
+
<build>
<finalName>my-webapp</finalName>
</build>
</project>
--------------------
++----+
Note the <<<\<packaging\>>>> element - this tells Maven to build as a WAR. Change into the webapp project's directory
and try:
--------------------
++----+
mvn clean package
--------------------
++----+
You'll see <<<target/my-webapp.war>>> is built, and that all the normal steps were executed.
@@ -1176,7 +1139,7 @@ mvn clean package
Firstly, we need to add a parent <<<pom.xml>>> file in the directory above the other two, so it should look like this:
--------------------
++----+
+- pom.xml
+- my-app
| +- pom.xml
@@ -1188,30 +1151,32 @@ mvn clean package
| +- src
| +- main
| +- webapp
--------------------
++----+
The POM file you'll create should contain the following:
--------------------
++----+
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
- <version>1.0-SNAPSHOT</version>
<artifactId>app</artifactId>
+ <version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
+
<modules>
<module>my-app</module>
<module>my-webapp</module>
</modules>
</project>
--------------------
++----+
We'll need a dependency on the JAR from the webapp, so add this to <<<my-webapp/pom.xml>>>:
--------------------
++----+
...
<dependencies>
<dependency>
@@ -1221,11 +1186,11 @@ mvn clean package
</dependency>
...
</dependencies>
--------------------
++----+
Finally, add the following <<<\<parent\>>>> element to both of the other <<<pom.xml>>> files in the subdirectories:
--------------------
++----+
<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
@@ -1236,17 +1201,17 @@ mvn clean package
<version>1.0-SNAPSHOT</version>
</parent>
...
--------------------
++----+
Now, try it... from the top level directory, run:
--------------------
++----+
mvn clean install
--------------------
++----+
The WAR has now been created in <<<my-webapp/target/my-webapp.war>>>, and the JAR is included:
--------------------
++----+
$ jar tvf my-webapp/target/my-webapp-1.0-SNAPSHOT.war
0 Fri Jun 24 10:59:56 EST 2005 META-INF/
222 Fri Jun 24 10:59:54 EST 2005 META-INF/MANIFEST.MF
@@ -1260,7 +1225,7 @@ $ jar tvf my-webapp/target/my-webapp-1.0
52 Fri Jun 24 10:59:56 EST 2005 index.jsp
0 Fri Jun 24 10:59:56 EST 2005 WEB-INF/lib/
2713 Fri Jun 24 10:59:56 EST 2005 WEB-INF/lib/my-app-1.0-SNAPSHOT.jar
--------------------
++----+
How does this work? Firstly, the parent POM created (called <<<app>>>), has a packaging of <<<pom>>>
and a list of modules defined. This tells Maven to run all operations over the set of projects instead of
@@ -1284,6 +1249,6 @@ $ jar tvf my-webapp/target/my-webapp-1.0
You might like to generate your IDEA workspace again from the top level directory...
--------------------
++----+
mvn idea:idea
--------------------
++----+
Modified: maven/site/trunk/src/site/apt/guides/getting-started/maven-in-five-minutes.apt
URL: http://svn.apache.org/viewvc/maven/site/trunk/src/site/apt/guides/getting-started/maven-in-five-minutes.apt?rev=1243212&r1=1243211&r2=1243212&view=diff
==============================================================================
--- maven/site/trunk/src/site/apt/guides/getting-started/maven-in-five-minutes.apt (original)
+++ maven/site/trunk/src/site/apt/guides/getting-started/maven-in-five-minutes.apt Sun Feb 12 08:52:59 2012
@@ -15,20 +15,20 @@ Maven in 5 Minutes
First, {{{../../download.html}download Maven}} and follow the {{{../../download.html#Installation}installation instructions}}.
After that, type the following in a terminal or in a command prompt:
-------
++-----+
mvn --version
-------
++-----+
It should print out your installed version of Maven, for example:
-------
++-----+
Apache Maven 3.0.3 (r1075438; 2011-02-28 18:31:09+0100)
Maven home: D:\apache-maven-3.0.3\bin\..
Java version: 1.6.0_25, vendor: Sun Microsystems Inc.
Java home: E:\Program Files\Java\jdk1.6.0_25\jre
Default locale: nl_NL, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
-------
++-----+
Depending upon your network setup, you may require extra configuration. Check out the
{{{../mini/guide-configuring-maven.html}Guide to Configuring Maven}} if necessary.
@@ -37,9 +37,9 @@ OS name: "windows 7", version: "6.1", ar
On your command line, execute the following Maven goal:
--------
++-----+
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
--------
++-----+
<If you have just installed Maven, it may take a while on the first run. This is because Maven is downloading
the most recent artifacts (plugin jars and other files) into your local repository. You may also need to
@@ -49,14 +49,14 @@ mvn archetype:generate -DgroupId=com.myc
You will notice that the <generate> goal created a directory with the same name given as the
artifactId. Change into that directory.
--------
++-----+
cd my-app
--------
++-----+
Under this directory you will notice the following
{{{../introduction/introduction-to-the-standard-directory-layout.html}standard project structure}}.
--------
++-----+
my-app
|-- pom.xml
`-- src
@@ -72,28 +72,31 @@ my-app
`-- mycompany
`-- app
`-- AppTest.java
--------
++-----+
- The src/main/java directory contains the project source code, the src/test/java directory contains
- the test source, and the pom.xml is the project's Project Object Model, or POM.
+ The <<<src/main/java>>> directory contains the project source code, the <<<src/test/java>>> directory contains
+ the test source, and the <<<pom.xml>>> file is the project's Project Object Model, or POM.
** The POM
- The pom.xml file is the core of a project's configuration in Maven. It is a single configuration
+ The <<<pom.xml>>> file is the core of a project's configuration in Maven. It is a single configuration
file that contains the majority of information required to build a project in just the way you want.
The POM is huge and can be daunting in its complexity, but it is not necessary to understand all
of the intricacies just yet to use it effectively. This project's POM is:
-------
++-----+
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
- <packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
<name>Maven Quick Start Archetype</name>
<url>http://maven.apache.org</url>
+
<dependencies>
<dependency>
<groupId>junit</groupId>
@@ -103,7 +106,7 @@ my-app
</dependency>
</dependencies>
</project>
-------
++-----+
** What did I just do?
@@ -117,13 +120,13 @@ my-app
** Build the Project
--------
++-----+
mvn package
--------
++-----+
The command line will print out various actions, and end with the following:
--------
++-----+
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
@@ -132,7 +135,7 @@ mvn package
[INFO] Finished at: Thu Jul 07 21:34:52 CEST 2011
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------
--------
++-----+
Unlike the first command executed (<archetype:generate>) you may notice the second is simply
a single word - <package>. Rather than a goal, this is a <phase>. A phase is a step in the
@@ -157,15 +160,15 @@ mvn package
You may test the newly compiled and packaged JAR with the following command:
--------
++-----+
java -cp target/my-app-1.0-SNAPSHOT.jar com.mycompany.app.App
--------
++-----+
Which will print the quintessential:
--------
++-----+
Hello World!
--------
++-----+
* Running Maven Tools
@@ -207,18 +210,18 @@ Hello World!
An interesting thing to note is that phases and goals may be executed in sequence.
-------
++-----+
mvn clean dependency:copy-dependencies package
-------
++-----+
This command will clean the project, copy dependencies, and package the project (executing all phases up to
<package>, of course).
** Generating the Site
-------
++-----+
mvn site
-------
++-----+
This phase generates a site based upon information on the project's pom. You can look at the
documentation generated under <<<target/site>>>.
@@ -228,4 +231,3 @@ mvn site
We hope this quick overview has piqued your interest in the versitility of Maven. Note that this is a very
truncated quick-start guide. Now you are ready for more comprehensive details concerning
the actions you have just performed. Check out the {{{./index.html}Maven Getting Started Guide}}.
-