Introduction to
    Maven2
  Sapporo Java Community
      Shuji Watanabe
What Maven2



http://maven.apache.org/
Project Management?
Why Maven2
CoC / Convention over Configuration




DRY / Dont Repeat Yourself

  pom          multi project
Requments

JDK 1.4 or above
Setup
Download
           JAVA_HOME

Maven2/bin
Maven2 Project
POM (Project Object Model)
  pom.xml /



Eclipse -> maven2 eclipse plugin
NetBeans -> NetBeans maven plugin
Create Maven Project
mvn archetype:create
    plugin     command

plugin

command

http://maven.apache.org/plugins/
Create Maven2 Project
 mvn archetype:create
 -DgroupId=jp.example -DartifactId=aaa
 archetype =

 groupId

 artifactId

      jp.example.aaa
Project structure
ProjectRoot/
 + src/
 | + main/
 | | + java/          ... source
 | | + resources/
 | + test/
 |     + java/        ... test source
 |     + resources/
 + pom.xml
Dependency
        Management
dependencies

GroupId, ArtifactId,Version


scope / compile, test,provide
<dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
</dependencies>
Repositories


Central
Local
Bender / seasar2, java.net, internal
Life Cycle and Goal
   default     clean
  compile
                site
    test

  package

   install

   deploy
Next...
Customize Project
Eclipse / Netbeans
Report (Test Report, Coverage, JavaDoc)
Multi Module Project
CI (Continuous Integration/ Hudson)

Introduction To Maven2