o adding in converted features doco

o adding in converted what is maven doco
o removing old getting started guide
o fixing references on the front page
o removing features/what is maven FAQ entries as they have whole documents now



git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@325904 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2005-10-17 14:57:35 +00:00
parent dfc3afb54b
commit 5c0108ad1d
13 changed files with 469 additions and 584 deletions

View File

@ -11,16 +11,16 @@
<url>http://maven.apache.org/maven2</url>
<inceptionYear>2001</inceptionYear>
<distributionManagement>
<!--
<site>
<id>website</id>
<url>scp://minotaur.apache.org/www/maven.apache.org/maven2</url>
</site>
-->
<site>
<!--
<stagingSite>
<id>beaver</id>
<url>scp://beaver.codehaus.org/home/users/jvanzyl/public_html/maven2/</url>
</site>
</stagingSite>
-->
</distributionManagement>
<reporting>
<excludeDefaults>true</excludeDefaults>

View File

@ -0,0 +1,161 @@
------
Guide to the APT Format
------
Jason van Zyl
------
12 October 2005
------
Books on Maven
* Maven: A Developer's Notebook
* O'Reilly
* Vincent Massol, Tim O'Brien
* July 2005
Maven in the Press
Have written or would like to write a story on Maven? {{{../../mail-lists.html}Contact us}} on the developers mailing list.
* {{{http://www.internetnews.com/dev-news/article.php/3381841}Apache's Maven Comes of Age}} (Coverage of the release of Maven 1.0)
* internetnews.com
* Sean Michael Kerner
* 15 July 2004</td>
Articles on Maven
* {{{http://www.onjava.com/pub/a/onjava/2005/09/07/maven.html}Building J2EE Projects with Maven}}
* Vincent Massol
* 7 September 2005
* {{{https://sydneyjug.dev.java.net/files/documents/922/15554/sjug20050601.pdf}Maven 2.0 and Continuum SJUG Presentation}}
* Brett Porter
* 1 June 2005
* {{{http://www-128.ibm.com/developerworks/opensource/library/os-maven/index.html}Exploiting Maven in Eclipse}}
* developerWorks
* Gilles Dodinet
* 24 May 2005
* {{{http://www-128.ibm.com/developerworks/websphere/library/techarticles/0503_boog/0503_boog.html?ca=dgr-lnxw09Maven}Managing WebSphere Portal V5.1 projects with Apache Maven and Rational Application Developer 6.0}}
* developerWorks
* Hinrich Boog
* 30 March 205
* {{{http://www.codehaus.org/~vmassol/blog/Maven%201.0%20-%2020041216.ppt}Maven 1.0 Javapolis Presentation}}
* Vincent Massol
* 16 December 2004
* {{{http://www.oracle.com/technology/pub/articles/masterj2ee/j2ee_wk2.html}Master and Commander by Julien Dubois}}
* Oracle
* Julien Dubois
* November 2004
* {{{http://www.manfred-wolff.de/Maven-short.pdf}installing and working with Maven (in German)}}
* Manfred Wolff
* August 2004
* {{{http://www.onjava.com/pub/a/onjava/2004/03/17/maven.html}Extending Maven Through Plugins by Eric Pugh}}
* OnJava
* Eric Pugh
* 17 March 2004
* {{{http://www.theserverside.com/articles/article.tss?l=MavenMagic}Maven Magic - a tutorial on Maven and J2EE projects.}}
* TheServerSide
* Srikanth Shenoy
* November 2003
* {{{http://www.jdocentral.com/JDO_Articles_20031117.html}JDO Meets Maven}}
* JDOCentral
* Andy Jefferson
* 17 November 2003
* {{{http://www.onjava.com/pub/a/onjava/2003/10/22/maven.html}Developing with Maven by Rob Herbst}}
* OnJava
* Rob Herbst
* 22 October 2003
* {{{http://www.devx.com/java/Article/17204}Apache Maven Simplifies the Java Build Process Even More Than Ant}}
* DevX
* Dave Ford
* 2 September 2003
* {{{http://www.pivolis.com/pdf/J2EE_projects_Maven_V1.1.pdf}Building J2EE applications with Maven (Slides from TheServerSide Symposium)}}
* TheServerSide
* Vincent Massol
* 27 June 2003
* {{{http://www.javaworld.com/javaworld/jw-10-2002/jw-1011-maven.html}Maven ties together tools for better code management}}
* JavaWorld
* Jeff Linwood
* 11 October 2002
* {{{http://www.javausergroup.at/events/maven.pdf}The Stairway to Maven}}
* Siegfried G<>SCHL
* 26 June 2002
* {{{http://wiki.astrogrid.org/bin/view/Astrogrid/MakingWarWithMaven}How to get Maven to build your web service into a WAR on AstroGrid}}
* Astrogrid
* {{{http://wiki.astrogrid.org/bin/view/Astrogrid/MavenFAQ}Some Maven FAQs on AstroGrid}}
* Astrogrid
* {{{http://wiki.astrogrid.org/bin/view/Astrogrid/UsefulMavenNotes}Some Useful Maven Notes on AstroGrid}}
* Astrogrid
* {{{http://etudiant.univ-mlv.fr/~mvongvil/Maven_Intro.html}An Introduction to Maven</a> (in French).}}
* {{{http://hotwork.sourceforge.net/hotwork/manual/maven/index.html}A tutorial for Maven, J2EE projects, and MevenIDE}} (in Portuguese).
If you are writing an article on Maven we suggest contacting the developers on the mailing list as we would be happy
to provide feedback to help ensure accuracy in your artiticle. Just ping us on the {{mail-lists.html}dev mailing list}}
to get in touch.

View File

@ -0,0 +1,97 @@
----
Maven Getting Started Guide
-----
Jason van Zyl
-----
12 October 2005
-----
Glossary
This document describes some of the most common terms encountered while
using Maven. These terms, that have an explicit meaning for Maven, can
sometimes be confusing for newcomers.
* Project:
Maven thinks in terms of projects. Everything that you will build
are projects. Those projects follow a well defined "Project Object
Model". Projects can depend on other projects, in which case the
latter are called "dependencies". A project may consistent of several
subprojects, however these subprojects are still treated equally as
projects.
* Project Object Model (POM):
The Project Object Model, almost always referred as the POM for brevity,
is the metadata that Maven needs to work with your project. Its name is
"project.xml" and it is located in the root directory of each project.
To learn how to build the POM for your project, please read about the
<a href="project-descriptor.html">project descriptor</a>.
* Artifact:
An artifact is something that is either produced or used by a
project. Examples of artifacts produced by Maven for a project
include: JARs, source and binary distributions, WARs.
Each artifact is uniquely identified by a <a href="#GroupId">group ID</a>
and an artifact ID which is unique within a group.
* GroupId:
A group ID is a universally unique identifier for a project. While this is often just
the project name (eg. <code>commons-collections</code>), it is helpful to use a fully-qualified
package name to distinguish it from other projects with a similar name (eg. <code>org.apache.maven</code>).
* Dependency:
A typical Java project relies on libraries to build and/or run.
Those are called "dependencies" inside Maven. Those dependencies are
usually other projects' JAR artifacts, but are referenced by the POM
that describes them.
* Plugin:
Maven is organized in plugins. Every piece of functionality in
Maven is provided by a plugin. Plugins provide <a href="#Goal">goals</a> and use the
metadata found in the POM to perform their task. Examples of plugins are: jar,
eclipse, war. Plugins are written in <a href="http://jakarta.apache.org/jelly/">Jelly</a>
and can be added, removed and edited at runtime.
* Goal:
Goals are what are executed to perform an action on the project. For example, the
<code>jar:jar</code> will compile the current project and produce a JAR.
Each goal exists in a plugin (except for those that you define yourself), and the
goal name usually reflects the plugin (eg. <code>java:compile</code> comes from the
<code>java</code> plugin).
* Repository:
A repository is a structured storage of project artifacts. Those
artifacts are organized under the following structure:
<br/>
<code>$MAVEN_REPO/group id/artifact type/project-version.extension</code>
<br/>
For instance, a Maven JAR artifact will be stored in a repository
under <code>/repository/maven/jars/maven-1.0-beta-8.jar</code>.
<br/>
There are different repositories that Maven uses. The "remote
repositories" are a list of repositories to download from.
This might include an internet repository, its mirrors, and a private company
repository. The "central repository" is the one to upload generated artifacts to
(for developers of a company for instance). The "local repository" is the one
that you will have on your computer. Artifacts are downloaded just once (unless they
are a <a href="#Snapshots">SNAPSHOT</a>) from the remote repository to your local
repository.
* Snapshots:
Projects can (and should) have a special version including <code>SNAPSHOT</code>
to indicate that they are a "work in progress", and are not yet released. When a
snapshot dependency is encountered, it is always looked for in all remote repositories,
and downloaded again if newer than the local copy.
<br/>
The version can either be the string <code>SNAPSHOT</code> itself, indicating
"the very latest" development version, or something like <code>1.1-SNAPSHOT</code>,
indicating development that will be released as 1.1 (i.e. newer than 1.0, but not yet 1.1).
* XDoc:
XDoc is the format of documentation that Maven currently understands. It is quite simple, and
allows embedding XHTML within a simple layout that is transformed into a uniform site.
<br/>
For information on how to create XDoc files, refer to the
<a href="../using/site.html">Building a Project Web Site</a> document.

View File

@ -43,3 +43,12 @@ How do I Join the Project?
rights and nothing else is frowned upon, as is asking to be made a committer without having contributed
sufficiently to be invited.
~~ Resources for committers
~~<li><a href="http://www.apache.org/dev/">Developer Resources</a></li>
~~<li><a href="http://www.apache.org/foundation/">About the Apache Software Foundation</a></li>
~~<li><a href="http://www.apache.org/dev/committers.html">Committer FAQ</a></li>
~~<li><a href="http://www.apache.org/~vgritsenko/stats/projects/maven.html">Web Stats</a></li>
~~<li><a href="http://wiki.apache.org">Apache Wiki</a></li>

View File

@ -205,3 +205,24 @@ Available formats
Before committing files in subversion repository, you need to read the
{{{http://www.apache.org/dev/version-control.html#https-svn}Committer Subversion Access}}
document and you must set your svn client with these properties file : {{svn-eol-style.txt}}
* Maven Code Style
The following sections show how to set up the code style for Maven in IDEA and Eclipse.
It is strongly preferred that patches use this style before they are spplied.
** IntelliJ IDEA 4.5+
Download <<<{{{../../maven-codestyle.xml}maven-codestyle.xml}}>>> and copy it to
<<<~/.IntelliJIDEA/config/codestyles>>> then restart IDEA. On Windows, try
<<<C:\Documents and Settings\<username>\.IntelliJIDEA\config\codestyles>>>
After this, restart IDEA and open the settings to select the new code style.
** Eclipse 3.x">
Download <<<{{{../../maven-eclipse-codestyle.xml}maven-eclipse-codestyle.xml}}>>>.
After this, select Window \> Preferences, and open up the configuration for Java \> Code
Style \> Code Formatter. Click on the button labeled Import... and select the file you
downloaded. Give the style a name, and click OK.

View File

@ -33,7 +33,7 @@ Sections
* {{{index.html#How do I compile my test sources and run my unit tests?}How do I compile my test sources and run my unit tests?}}
* {{{index.html#How do I create a JAR and install it in my local repository?}How do I create a JAR and install it in my local repository?}}
* {{{index.html#How do add resources to my JAR?}How do add resources to my JAR?}}
* {{{index.html#How do I filter resource files?}How do I filter resource files?}}
@ -49,7 +49,7 @@ Sections
* {{{index.html#How do I use plug-ins?}How do I use plug-ins?}}
* {{{index.html#How do I control what version of a plug-in I use?}How do I control what version of a plug-in I use?}}
* {{{index.html#How do I build more than one project at once?}How do I build more than one project at once?}}
[]
@ -324,13 +324,13 @@ Results :
+----+
Some things to notice about the output:
* Maven downloads more dependencies this time. These are the dependencies and plugins necessary for executing the tests
(it already has the dependencies it needs for compiling and won't download them again).
* Before compiling and executing the tests Maven compiles the main code (all these classes are up to date because
we haven't changed anything since we compiled last).
If you simply want to compile your test sources (but not execute the tests), you can execute the following:
+----+
@ -346,6 +346,8 @@ Results :
Making a JAR file is straight forward enough and can be accomplished by executing the following command:
~~ How to skip tests ... jvz
+----+
m2 package
@ -574,7 +576,7 @@ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStr
Maven, put a reference to the property that will contain the value into your resource file using the syntax <<<$\{<property name}>\}>>>.
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:
+----+
@ -612,7 +614,7 @@ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStr
In addition, we had to explicitly state that the resources are located in the src/main/resources directory. All of this
information was provided as default values previously, but because the default value for <<<filtering>>> is false, we had
to add this to our pom.xml in order to override that default value and set <<<filtering>>> to true.
To reference a property defined in your pom.xml, the property name uses the names of the XML elements that define the value,
with "pom" being allowed as an alias for the project (root) element. So $\{pom.name\} refers to the name of the project,
$\{pom.version\} refers to the version of the project, $\{pom.build.finalName\} refers to the final name of the file created
@ -620,8 +622,8 @@ InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStr
defined in your pom.xml for the values to be available here. Similarly, values in the user's settings.xml can be referenced
using property names beginning with "settings" (for example, $\{settings.localRepository\} refers to the path of the user's
local repository).
To continue our example, let's add a couple of properties to the application.properties file (which we put in the
To continue our example, let's add a couple of properties to the application.properties file (which we put in the
src/main/resources directory) whose values will be supplied when the resource is filtered:
+----+
@ -661,7 +663,7 @@ my.filter.value=hello!
+----+
Next, we'll add a reference to this new file in the pom.xml:
Next, we'll add a reference to this new file in the pom.xml:
+----+
@ -707,7 +709,7 @@ application.version=${pom.version}
message=${my.filter.value}
+----+
the next execution of the <<<m2 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):
@ -749,7 +751,7 @@ message=${my.filter.value}
Filtering resources can also get values from system properties; either the system properties built into Java (like java.version or
user.home) or properties defined on the command line using the standard Java -D parameter. To continue the example, let's change
our application.properties file to look like this:
+----+
# application.properties
@ -766,7 +768,7 @@ command.line.prop=${command.line.prop}
m2 process-resources "-Dcommand.line.prop=hello again"
+----+
* {How do I use external dependencies?}
@ -774,7 +776,7 @@ m2 process-resources "-Dcommand.line.prop=hello again"
You have, in fact, been using an external dependency all this time, but here we'll talk about how this
works in a bit more detail. For a more thorough introduction, please refer to our
{{{introduction-to-dependency-management.html}Introduction to Dependency Management}}.
The <<<dependencies>>> section of the pom.xml lists all of the external dependencies that particular needs
in order to build (whether it needs that dependency at compile time, test time, run time, or whatever). Right
now, our project is depending on JUnit only (I took out all of the resource filtering stuff for clarity):
@ -808,13 +810,13 @@ m2 process-resources "-Dcommand.line.prop=hello again"
For more information on everything you can specify for a dependency, see the {{{../../../maven-model/maven.html}Project Descriptor Reference}}.
~~DJ: Does this link work? I can't find the document.
For more information about the dependency mechanism as a whole, see {{{../../dependency-mechanism.html}Dependency Mechanism}}.
With this information about a dependency, Maven will be able to reference the dependency when it builds the project. Where does
Maven reference the dependency from? Maven looks in your local repository (<<<~/.m2/repository>>> is the default location) to find
all dependencies. In a {{{How do I create a JAR and install it in my local repository?}previous section}}, we installed the artifact
from our project (my-app-1.0-SNAPSHOT.jar) into the local repository. Once it's installed there, another project can reference that jar
as a dependency simply by adding the dependency information to its pom.xml:
+----+
<project>
@ -833,7 +835,7 @@ m2 process-resources "-Dcommand.line.prop=hello again"
</project>
+----+
What about dependencies built somewhere else? How do they get into my local repository? Whenever a project references a dependency
that isn't available in the local repository, Maven will download the dependency from a remote repository into the local repository. You
probably noticed Maven downloading a lot of things when you built your very first project (these downloads were dependencies for the
@ -876,11 +878,11 @@ m2 process-resources "-Dcommand.line.prop=hello again"
the current release version). Alongside the maven-metadata.xml file, we can see a directory corresponding to each version of the
log4j library. Inside each of these, we'll find the actual jar file (e.g. log4j-1.2.12.jar) as well as a pom file (this is the pom.xml
for the dependency, indicating any further dependencies it might have and other information) and another maven-metadata.xml file.
There's also an md5 file corresponding to each of these, which contains an MD5 hash for these files. You can use this to authenticate
There's also an md5 file corresponding to each of these, which contains an MD5 hash for these files. You can use this to authenticate
the library or to figure out which version of a particular library you may be using already.
Now that we know the information we need, we can add the dependency to our pom.xml:
+----+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@ -909,9 +911,9 @@ m2 process-resources "-Dcommand.line.prop=hello again"
</project>
+----+
Now, when we compile the project (<<<m2 compile>>>), we'll see Maven download the log4j dependency for us.
~~DJ: Current
* {How do I deploy my jar in my remote repository?}

View File

@ -0,0 +1,68 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<author email="brett@apache.org">Brett Porter</author>
<title>How to Help</title>
</properties>
<body>
<section name="How to Help">
<p>
As with any open source project, there are several ways you can help:
</p>
<ul>
<li>Join the <a href="../mail-lists.html">mailing list</a> and answer other user's questions</li>
<li>Report bugs, feature requests and other issues in the <a href="../issue-tracking.html">issue tracking</a>
application.</li>
<li><a href="patches.html">Submit patches</a> to reported issues (both those you find, or that others have
filed)</li>
</ul>
<p>
Your participation in the community is much appreciated!
</p>
</section>
<section name="Why Would I Want to Help?">
<p>
There are several reasons these are good things.
</p>
<ul>
<li>By answering other people's questions, you can learn more for yourself</li>
<li>By submitting your own fixes, they get incorporated faster</li>
<li>By reporting issues, you ensure that bugs don't get missed, or forgotten</li>
<li>You are giving back to a community that has given you software for free</li>
</ul>
</section>
<section name="How do I Join the Project?">
<p>
Projects at Apache operate under a meritocracy, meaning those that the developers notice participating to a
high extent will be invited to join the project as a committer.
</p>
<p>
This is as much based on personality and ability to work with other developers and the community as it is with
proven technical ability. Being unhelpful to other users, or obviously looking to become a committer for bragging
rights and nothing else is frowned upon, as is asking to be made a committer without having contributed
sufficiently to be invited.
</p>
</section>
</body>
</document>

View File

@ -10,6 +10,23 @@ Feature Summary
The following are the key features of Maven in a nutshell:
* Simple project setup that follows best practices - get a new project or module started in seconds
* Consistent usage across all projects means no ramp up time for new developers coming onto a project
* Superior dependency management including automatic updating, dependency closures (also known as transitive dependencies)
* Able to easily work with multiple projects at a time
* A large and growing repository of libraries and metadata to use out of the box, and arrangements in place with the largest Open Source projects for
real-time availability of their latest releases
* Extensible, with the ability to easily write plugins in Java or other scripting languages
* Instant access to new features with little or no extra configuration
* Ant tasks for dependency management and deployment outside of Maven
* Model based builds:
Maven is able to build any number of projects into predefined output types
such as a JAR, WAR, or distribution based on metadata about the project, without
@ -41,4 +58,4 @@ Feature Summary
[]
~~ this needs to be greatly expanded and is too detailed here ... jvz
~~ this needs to be greatly expanded and is too detailed here ... jvz

View File

@ -0,0 +1,61 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<document>
<properties>
<author email="brett@apache.org">Brett Porter</author>
<title>Submitting Patches</title>
</properties>
<body>
<section name="How to Submit a Patch">
<p>
When you fix a bug in the Maven source code, you will submit a patch to the <a href="../issue-tracking.html">issue tracking system</a> for developers to apply.
</p>
<p>
First, if this is a new issue of your own that is being fixed, ensure that the issue is actually in the issue
tracking system. Look for an existing one, and if it is not found, create a new one.
</p>
<p>
Ensure that you have done a full update from source control recently, and have tested your changes. If it is a
new feature or changes the bevahiour of something, make sure to update the relevant documentation. You may
even like to add a <code>changes.xml</code> item describing your change, the issue, and who you are in the
<code>due-to="Your Name"</code> attribute.
</p>
<p>
You should use the Maven code style for your contributions, and be careful to limit changes only to the
relevant areas of the submission. Some <a href="../developers/code-style.html">code style descriptors</a>
for different IDEs are also available.
</p>
<p>
Make sure any new files you've created that you want to add have had <code>svn add</code> run on them first.
</p>
<p>
Prepare the patch by going to the top level of the checkout (the <code>trunk</code>), and running:
</p>
<source>svn diff >ISSUE-NUMBER.txt</source>
<p>
Replace ISSUE-NUMBER in the filename with the actual ticket number in the issue tracking system.
Finally, attach the file to the issue tracking system as an attachment.
</p>
</section>
</body>
</document>

View File

@ -2,62 +2,6 @@
<faqs title="About Maven 2.0">
<part id="about">
<faq id="what-is-maven">
<question>What is Maven?</question>
<answer>
<p>
Maven is a tool that is used to process your project information and sources, not only to build it into
binary form but also to generate information to help you get a single view of all aspects of your project,
and in some cases related projects.
</p>
<p>
For a full description, see the main
<a href="http://maven.apache.org/about/whatismaven.html">What is Maven?</a>
document.
</p>
<p>
Maven has also grown into a project that is building other products to help in the software development
lifecycle<!--,
such as the <a href="http://maven.apache.org/continuum">Continuum</a> continuous integration server -->.
<a href="http://maven.apache.org/project/index.html">More information about the Maven Project</a>
.
</p>
</answer>
</faq>
<faq id="features">
<question>What are the features of Maven 2.0?</question>
<answer>
<p>
Maven 2.0 has the following major features:
</p>
<ul>
<li>Simple project setup that follows best practices - get a new project or module started in seconds</li>
<li>Consistent usage across all projects means no ramp up time for new developers coming onto a project</li>
<li>Superior dependency management including automatic updating, dependency closures (also known as transitive
dependencies)</li>
<li>Able to easily work with multiple projects at a time</li>
<li>A large and growing repository of libraries and metadata to use out of the box, and arrangements in place
with the largest Open Source projects for real-time availability of their latest releases</li>
<li>Extensible, with the ability to easily write plugins in Java or other scripting languages</li>
<li>Instant access to new features with little or no extra configuration</li>
<li>
<a href="ant-tasks.html">Ant tasks</a>
for dependency management and deployment outside of Maven
</li>
</ul>
<p>
The following features are available in Maven 1.0 and will be available and much improved in Maven 2.0 through
the coming releases:
</p>
<ul>
<li>Deployment and release management</li>
<li>Comprehensive project information and reporting</li>
<li>Website and documentation building tools</li>
</ul>
</answer>
</faq>
<faq id="m2-goals">
<question>Tell me about the goals of Maven 2.0</question>
<answer>

View File

@ -15,7 +15,9 @@
<item name="Maven 2" href="http://maven.apache.org/maven2/"/>
</links>
<menu name="Installing">
<menu name="Quick Links">
<item name="Features" href="/features.html"/>
<item name="What is Maven" href="/what-is-maven.html"/>
<item name="Download" href="/download.html"/>
<item name="Install" href="/download.html#installation"/>
<item name="Getting Started" href="/guides/getting-started/index.html"/>
@ -32,38 +34,6 @@
<item name="Powered By" href="/powered-by-m2.html"/>
</menu>
<!--
<menu name="User's Guide">
<item name="Getting Started" href="/getting-started.html"/>
<item name="Build Lifecycle" href="/lifecycle.html"/>
<item name="Plugin Overview" href="/plugin-overview.html"/>
<item name="Dependency Mechanism" href="/dependency-mechanism.html"/>
<item name="Creating a Site" href="/site.html"/>
</menu>
-->
<!--
<menu name="Plugin Developers">
<item name="Plugin Development Guide" href="/developers/plugin-development-guide.html"/>
</menu>
<menu name="Developers">
<item name="Developers Guide" href="/developers/development-guide.html"/>
<item name="Documentation Needed" href="/docs-required.html"/>
<item name="Building Maven 2.0" href="/developers/building.html"/>
</menu>
-->
<!--
<menu name="Reference">
<item name="Project Descriptor" href="/maven-model/maven.html"/>
<item name="Settings Descriptor" href="/maven-settings/settings.html"/>
<item name="Available Plugins" href="/plugins/index.html"/>
<item name="Mojo API" href="/developers/mojo-api-specification.html"/>
<item name="Ant Tasks" href="/ant-tasks.html"/>
<item name="APT Reference" href="/apt-format.html"/>
</menu>
-->
${reports}
</body>
</project>

View File

@ -1,448 +0,0 @@
<document>
<properties>
<title>Getting Started</title>
<author email="brett@apache.org">Brett Porter</author>
</properties>
<body>
<section name="Getting Started">
<p>
This section will help you create a trivial project and build it, and should provide enough information
to build any project that requires Maven 2.0. It assumed that you have already
<a href="download.html">Downloaded and Installed</a>
a Maven 2.0 release.
</p>
<p>
If you are behind a proxy, make sure that you've read
<a href="configuration.html">Configuring Maven</a>
first
for instructions on how to configure your proxy.
</p>
<subsection name="Creating a Project Skeleton">
<p>
The first step is to create a Maven 2.0 project to work on. Run the following command:
</p>
<source>m2 archetype:create -DgroupId=com.mycompany.app -DartifactId=my-app</source>
<p>
This command creates a layout according the the conventions laid out
<a href="http://maven.apache.org/reference/conventions.html">here</a>
.
</p>
<!-- TODO
<p>
If you'd like to know more about archetypes, see the <a href="archetypes.html">Archetypes</a> section.
</p>
-->
<p>
The file
<code>pom.xml</code>
is the Maven 2.0 project descriptor.
</p>
<source><![CDATA[
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>]]></source>
<p>
You can get a full reference to the
<a href="maven-model/maven.html">project descriptor</a>
to see what other
elements are available.
</p>
<p>
You'll notice there is a
<code>src/main/java</code>
directory containing a simple source file to compile,
and a
<code>src/test/java</code>
directory containing a trivial unit test.
</p>
<p>
Let's now change into the project's directory and try a few things...
</p>
</subsection>
<subsection name="Building a Project">
<p>
Maven 2.0's primary build is built around a defined lifecycle. There are many stages, but the most used ones
from the command line are:
</p>
<ul>
<li>
<code>generate-sources</code>
- perform any source generation
</li>
<li>
<code>compile</code>
- compile the sources in
<code>src/main/java</code>
as well as any generated source
</li>
<li>
<code>test</code>
- compile and run the unit tests
</li>
<li>
<code>package</code>
- package the source code into an archive (primarily a JAR)
</li>
<li>
<code>install</code>
- install the package in the local repository for use with other projects
</li>
<li>
<code>deploy</code>
- deploy the package to the remote repository
</li>
</ul>
<p>
Note that executing any stage in the lifecycle will execute all of the preceding ones, so you need only run:
</p>
<source>m2 install</source>
<p>
<b>Note:</b>
if you are using the project you generated in the first step, make sure you are running this
command from inside the directory it created, where
<code>pom.xml</code>
resides.
</p>
<p>
This will do all of the steps - generating sources, compiling, copying resources, packaging and finally
installing.
</p>
<p>
If you try that, you'll see that the file is copied to a directory under
<code>~/.m2/repository</code>
.
This is also where all those downloaded files go - it is called your
<i>local repository</i>
.
The location is configurable - see
<a href="configuration.html">Configuration</a>
for more information.
</p>
<!-- TODO
<p>
For more information on the lifecycle, see the <a href="lifecycle.html">Build Lifecycle</a>.
</p>
-->
<p>
You can run other standalone goals as well, for example:
</p>
<source>m2 clean:clean install</source>
<p>
This will remove the
<code>target</code>
directory with all the build data before starting so that it is
fresh.
</p>
<p>
Perhaps you'd like to generate an IntelliJ IDEA descriptor for the project?
</p>
<source>m2 idea:idea</source>
<p>
This can be run over the top of a previous IDEA project - it will update the settings rather than starting
fresh.
</p>
<p>
<b>Note:</b>
some familiar goals from Maven 1.0 are still there - such as
<code>jar:jar</code>
, but they might
not behave like you'd expect. Presently,
<code>jar:jar</code>
will not recompile sources - it will simply just
create a JAR from the
<code>target/classes</code>
directory, under the assumption everything else had already
been done.
</p>
</subsection>
<a name="configuring_plugins"/>
<subsection name="Configuring Plugins">
<p>
What if you would like to customise whether a plugins is enabled or how a plugin operates?
In Maven 1.0, you would have added some
<code>preGoal</code>
to
<code>maven.xml</code>
and some
entries to
<code>project.properties</code>
. Here, it is a little different.
</p>
<p>
For this example, we will configure the Java compiler to allow JDK 5.0 sources. This is as simple as
adding this to your POM:
</p>
<source><![CDATA[.
.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
.
.]]></source>
<p>
You'll notice that all plugins in Maven 2.0 look much like a dependency - and in some ways they are.
This plugin will be automatically downloaded and used - including a specific version if you request it
(the default is to use the latest available).
</p>
<p>
The
<code>configuration</code>
element applies the given parameters to every goal from the compiler plugin.
It is possible to change a parameter just for an individual goal as well - for example, to change the
debug flag for test sources:
</p>
<source><![CDATA[.
.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<goals>
<goal>
<id>testCompile</id>
<configuration>
<debug>true</debug>
</configuration>
</goal>
</goals>
</plugin>
.
.]]></source>
<p>
To find out what configuration is available for a plugin, you can see the
<a href="plugins/">Plugins List</a>
and navigate to the plugin and goal you are using.
</p>
</subsection>
<subsection name="Other Project Types">
<p>
Note that the lifecycle applies to any project type. For example, back in the base direcotry we can create a
simple web application:
</p>
<source>
m2 archetype:create \
-DgroupId=com.mycompany.app -DartifactId=my-webapp \
-DarchetypeArtifactId=maven-archetype-webapp</source>
<p>
Note that these must all be on a single line. This will create a directory called
<code>my-webapp</code>
containing the following
project descriptor:
</p>
<source><![CDATA[<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-webapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>my-webapp</finalName>
</build>
</project>]]></source>
<p>
Note the
<code>&lt;packaging&gt;</code>
element - this tells Maven to build as a WAR. Change into the webapp project's directory and try:
</p>
<source>m2 clean:clean package</source>
<p>
You'll see
<code>target/my-webapp.war</code>
is built, and that all the normal steps were executed.
</p>
</subsection>
<subsection name="Multiple Modules">
<p>
The concept of dealing with multiple modules is built in to Maven 2.0.
In this section, we will show how to build the WAR above, and include the previous JAR as well in one step.
</p>
<p>
Firstly, we need to add a parent
<code>pom.xml</code>
file in the directory above the other two, so it should look like this:
</p>
<source>
+- pom.xml
+- my-app
| +- pom.xml
+- my-webapp
| +- pom.xml
</source>
<p>
The POM file you'll create should contain the following:
</p>
<source><![CDATA[<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>app</artifactId>
<packaging>pom</packaging>
<modules>
<module>my-app</module>
<module>my-webapp</module>
</modules>
</project>]]></source>
<p>
We'll need a dependency on the JAR from the webapp, so add this to
<code>my-webapp/pom.xml</code>
:
</p>
<source><![CDATA[
.
.
.
<dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
.
.
.]]></source>
<p>
Finally, add the following
<code>&lt;parent&gt;</code>
element to both of the other
<code>pom.xml</code>
files
in the subdirectories:
</p>
<source><![CDATA[<project>
<parent>
<groupId>com.mycompany.app</groupId>
<artifactId>app</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
.
.
.]]></source>
<p>
Now, try it... from the top level directory, run:
</p>
<source>m2 clean:clean install</source>
<p>
<b>Note:</b>
If you didn't remove the
<code>warName</code>
plugin configuration, this will have
failed due to a bug. Please remove that section, and try again.
</p>
<p>
The WAR has now been created in
<code>my-webapp/target/my-webapp.war</code>
, and the JAR is
included:
</p>
<source>$ 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
0 Fri Jun 24 10:59:56 EST 2005 META-INF/maven/
0 Fri Jun 24 10:59:56 EST 2005 META-INF/maven/com.mycompany.app/
0 Fri Jun 24 10:59:56 EST 2005 META-INF/maven/com.mycompany.app/my-webapp/
3239 Fri Jun 24 10:59:56 EST 2005 META-INF/maven/com.mycompany.app/my-webapp/pom.xml
0 Fri Jun 24 10:59:56 EST 2005 WEB-INF/
215 Fri Jun 24 10:59:56 EST 2005 WEB-INF/web.xml
123 Fri Jun 24 10:59:56 EST 2005 META-INF/maven/com.mycompany.app/my-webapp/pom.properties
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</source>
<p>
How does this work? Firstly, the parent POM created (called
<code>app</code>
), has a packaging of
<code>pom</code>
and a list of modules defined. This tells Maven to run all operations over the set of projects instead of
just the current one (to override this behaviour, you can use the
<code>--non-recursive</code>
command line
option).
</p>
<p>
Next, we tell the WAR that it requires the
<code>my-app</code>
JAR. This does a few things: it makes it available
on the classpath to any code in the WAR (none in this case), it makes sure the JAR is always built before the
WAR, and it indicates to the WAR plugin to include the JAR in its library directory.
</p>
<p>
You may have noticed that
<code>junit-3.8.1.jar</code>
was a dependency, but didn't end up in the WAR. The
reason for this is the
<code>&lt;scope&gt;test&lt;/scope&gt;</code>
element - it is only required for testing,
and so is not included in the web application as the compile time dependency
<code>my-app</code>
is.
</p>
<p>
The final step was to include a parent definition. This is different to the
<code>extend</code>
element you
may be familiar with from Maven 1.0: this ensures that the POM can always be located even if the project
is distributed separately from its parent by looking it up in the repository.
</p>
<p>
Unlike Maven 1.0, it is not required that you run
<code>install</code>
to successfully perform these steps - you can run
<code>package</code>
on its own
and the artifacts in the reactor will be used from the target directories instead of the local repository.
</p>
<p>
You might like to generate your IDEA workspace again from the top level directory...
</p>
<source>m2 idea:idea</source>
</subsection>
<subsection name="Other Topics">
<p>
That's all there is to this brief tutorial. This is by no means the limits of the capabilities of Maven 2.0,
but covers some of the basics and the new features.
</p>
<p>
If you'd like to know more about general Maven concepts, in association with how the current stable release,
Maven 1.0, works, see the
<a href="http://maven.apache.org">Maven website</a>
.
</p>
<p>
For more information on Maven 2.0, you can consult the
<a href="plugins/index.html">list of available plugins</a>
,
or the other documentation on this site.
</p>
</subsection>
</section>
</body>
</document>

View File

@ -43,12 +43,12 @@
<ul>
<li>
<i>
<a href="about.html#what-is-maven">What is Maven?</a>
<a href="what-is-maven.html">What is Maven?</a>
</i>
</li>
<li>
<i>What are the
<a href="about.html#features">features of Maven 2.0</a>
<a href="maven-features.html">features of Maven 2.0</a>
?
</i>
</li>
@ -122,7 +122,7 @@
<ul>
<li>
<i>
<a href="getting-started.html">Getting Started</a>
<a href="guides/getting-started/index.html">Getting Started</a>
</i>
</li>
<li>
@ -130,23 +130,6 @@
<a href="general.html">General FAQ</a>
</i>
</li>
<li>
<i>
<a href="configuration.html">Configuring Maven</a>
</i>
</li>
<li>
<i>
<a href="dependency-mechanism.html">Dependency Mechanism</a>
</i>
</li>
<!-- TODO
<li>
<i>
<a href="archetypes.html">Generating a Template Project: Archetypes</a>
</i>
</li>
-->
</ul>
<p>
<b>More coming soon -</b>