Maven2 101
Upcoming SlideShare
Loading in...5
×
 

Maven2 101

on

  • 3,314 views

A small presentation I made at Vivansa to introduce Maven 2 to my colleagues

A small presentation I made at Vivansa to introduce Maven 2 to my colleagues

Statistics

Views

Total Views
3,314
Views on SlideShare
3,277
Embed Views
37

Actions

Likes
2
Downloads
101
Comments
0

4 Embeds 37

http://www.slideshare.net 17
http://www.linkedin.com 12
http://coderwall.com 4
https://www.linkedin.com 4

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Maven2 101 Maven2 101 Presentation Transcript

  • Maven2 101 Sébastien Arbogast http://sebastien-arbogast.com March 2nd, 2010
  • Agenda
  • Agenda Generic concepts
  • Agenda Generic concepts Features
  • Agenda Generic concepts Features Best practices
  • Agenda Generic concepts Features Best practices Integration
  • Agenda Generic concepts Features Best practices Integration Demo
  • Agenda Generic concepts Features Best practices Integration Demo
  • Software Project Lifecycle
  • Build Software Project Lifecycle
  • Quality Build Software Project Lifecycle
  • Quality Build Software Project Lifecycle Documentation
  • Quality Build Software Project Lifecycle Deployment Documentation
  • Quality Build Software Project Lifecycle Deployment Documentation Reporting
  • Quality Build Website Software Project Lifecycle Deployment Documentation Reporting
  • Dependency Quality Management Build Website Software Project Lifecycle Deployment Documentation Reporting
  • Don’t tell me what to do Just tell me where things are (pom.xml)
  • Don’t tell me what to do Just tell me where things are (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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.epseelon</groupId> <artifactId>todolist</artifactId> <packaging>pom</packaging> <version>1.2.2-SNAPSHOT</version> <name>Epseelon TodoList</name> </project>
  • Convention over Configuration
  • project structure Convention over Configuration
  • naming project structure Convention over Configuration
  • naming project structure Convention versioning over Configuration
  • naming project structure Convention versioning over build phases Configuration
  • naming project structure Convention versioning over build phases Configuration repository layout
  • Modular Platform
  • Modular Platform Kernel: plugin management
  • Modular Platform Kernel: plugin management Plugins = MOJO’s
  • Modular Platform Kernel: plugin management Plugins = MOJO’s Compilers
  • Modular Platform Kernel: plugin management Plugins = MOJO’s Compilers Server integrations
  • Modular Platform Kernel: plugin management Plugins = MOJO’s Compilers Server integrations Quality tools
  • Modular Platform Kernel: plugin management Plugins = MOJO’s Compilers Server integrations Quality tools Etc.
  • Modular Platform Kernel: plugin management Plugins = MOJO’s Compilers Server integrations Quality tools Etc. Super POM
  • Build Lifecycle (Phases)
  • Build Lifecycle (Phases) Validate Compile Test Package Install Site Deploy
  • Build Lifecycle (Phases) Validate Compile Test Package Install Site Deploy
  • Build Lifecycle (Phases) Plugins+goals Validate Compile Test Package Install Site Deploy
  • Build Lifecycle (Phases) Plugins+goals Validate Compile maven-java-plugin:compile Test Package Install Site Deploy
  • Build Lifecycle (Phases) Plugins+goals Validate Compile maven-java-plugin:compile Test maven-test-plugin:test Package Install Site Deploy
  • Build Lifecycle (Phases) Plugins+goals Validate Compile maven-java-plugin:compile Test maven-test-plugin:test Package maven-jar-plugin:jar Install Site Deploy
  • Build Lifecycle (Phases) Plugins+goals Validate Compile maven-java-plugin:compile Test maven-test-plugin:test Package maven-jar-plugin:jar Install <project> Site ... <packaging>jar</packaging> Deploy ... </project>
  • Agenda Generic concepts Features Best practices Integration Demo
  • Repositories Epseelon
  • Repositories ibiblio codehaus java.net Internet creuset Epseelon Vivansa Sébastien Eric David
  • Repositories ibiblio codehaus java.net No more libs in SVN Internet creuset Epseelon Vivansa Sébastien Eric David
  • Repositories ibiblio codehaus java.net No more libs in SVN Internet Central repositories creuset Epseelon Vivansa Sébastien Eric David
  • Repositories ibiblio codehaus java.net No more libs in SVN Internet Central repositories Internal proxy (Nexus) creuset Epseelon Vivansa Sébastien Eric David
  • Repositories ibiblio codehaus java.net No more libs in SVN Internet Central repositories Internal proxy (Nexus) creuset Local repositories Epseelon Vivansa Sébastien Eric David
  • Repositories ibiblio codehaus java.net No more libs in SVN Internet Central repositories Internal proxy (Nexus) creuset Local repositories Epseelon Vivansa <project> Sébastien David Eric ... <repositories> <repository> <id>nexus_epseelon</id> <url>${epseelon.repo.public}</url> </repository> </repositories> ... </project>
  • Dependency Management
  • Dependency Management <project> ... <dependencies> <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0</version> </dependency> </dependencies> ... </project>
  • Dependency Management <project> ... <dependencies> <dependency> <groupId>javax.persistence</groupId> <artifactId>persistence-api</artifactId> <version>1.0</version> </dependency> </dependencies> ... </project> http://mirrors.ibiblio.org/pub/mirrors/maven2/javax/ persistence/persistence-api/1.0/persistence-api-1.0.jar
  • Project Structure
  • Project Structure src main java resources test java target generated-sources pom.xml
  • POM inheritance
  • POM inheritance <project> ... <parent> <groupId>org.eepseelon</groupId> <artifactId>todolist</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> ... </project>
  • POM inheritance <project> ... <parent> <groupId>org.eepseelon</groupId> <artifactId>todolist</artifactId> <version>1.0.0-SNAPSHOT</version> </parent> ... </project> If no parent is specified, parent is the Super-POM!
  • Multi-Module
  • Multi-Module <project> ... <modules> <module>common</module> <module>core</module> <module>app</module> </modules> ... </project>
  • Multi-Module <project> ... <modules> <module>common</module> <module>core</module> <module>app</module> </modules> ... </project> Must map directory structure!
  • Resource filtering
  • <project> Resource filtering ... <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build> <properties> <datasource>todolistDS</datasource> </properties> ... </project>
  • <project> Resource filtering ... <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build> <properties> <datasource>todolistDS</datasource> </properties> ... </project> => src/main/resources/META-INF/persistence.xml
  • <project> Resource filtering ... <build> <resources> <resource> <directory>src/main/resources</directory> <filtering>true</filtering> </resource> </resources> </build> <properties> <datasource>todolistDS</datasource> </properties> ... </project> => src/main/resources/META-INF/persistence.xml <non-jta-data-source> ${datasource} </non-jta-data-source>
  • Profiles
  • Profiles <project> ... <profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <datasource>todolistDS</datasource> </properties> </profile> </profiles> ... </project>
  • Profiles <project> ... <profiles> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <datasource>todolistDS</datasource> </properties> </profile> </profiles> ... </project> => mvn -Denv=prod install
  • Plugins
  • <project> ... Plugins <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ejb-plugin</artifactId> <configuration> <ejbVersion>3.0</ejbVersion> <archive> <manifestEntries> <Todolist-Version> ${project.version} </Todolist-Version> </manifestEntries> </archive> </configuration> </plugin> </plugins> </build> ... </project>
  • Documentation
  • Documentation +- src/ +- site/ +- apt/ | +- index.apt | +- xdoc/ | +- other.xml | +- fml/ | +- general.fml | +- faq.fml | +- site.xml
  • Documentation +- src/ +- site/ +- apt/ | +- index.apt Wiki-like | +- xdoc/ | +- other.xml | +- fml/ | +- general.fml | +- faq.fml | +- site.xml
  • Documentation +- src/ +- site/ +- apt/ | +- index.apt Wiki-like | +- xdoc/ | +- other.xml Docbook-like | +- fml/ | +- general.fml | +- faq.fml | +- site.xml
  • Documentation +- src/ +- site/ +- apt/ | +- index.apt Wiki-like | +- xdoc/ | +- other.xml Docbook-like | +- fml/ | +- general.fml | +- faq.fml | => mvn site +- site.xml
  • Other features Testing integration (JUnit, TestNG, Fitnesse, ...) Reporting (Clover, PMD, ...) Packaging (IzPack, JNLP, ...) Continuous integration (Continuum, Hudson, ...) SCM (Subversion, Mercurial, ...) Release management (Maven Release Plugin) Compiler integration (Groovy, Flex, ...)
  • Best Practices
  • Best Practices One module, one package!
  • Best Practices One module, one package! There’s a standard place for (almost) everything => no side structure
  • Best Practices One module, one package! There’s a standard place for (almost) everything => no side structure generated => target
  • Best Practices One module, one package! There’s a standard place for (almost) everything => no side structure generated => target Factor up dependency versions
  • Best Practices One module, one package! There’s a standard place for (almost) everything => no side structure generated => target Factor up dependency versions Specify plugin versions!
  • Best Practices One module, one package! There’s a standard place for (almost) everything => no side structure generated => target Factor up dependency versions Specify plugin versions! RTF(S)M!
  • Integration
  • Integration Sonatype m2eclipse: http://www.sonatype.com/books/m2eclipse- book/reference/
  • Integration Sonatype m2eclipse: http://www.sonatype.com/books/m2eclipse- book/reference/ IntelliJ Idea: native!
  • Integration Sonatype m2eclipse: http://www.sonatype.com/books/m2eclipse- book/reference/ IntelliJ Idea: native! Hudson, JIRA, Subversion: native
  • Resources
  • Resources Official site: http://maven.apache.org
  • Resources Official site: http://maven.apache.org Maven, the Definitive Guide: http://www.sonatype.com/products/maven/ documentation/book-defguide
  • Resources Official site: http://maven.apache.org Maven, the Definitive Guide: http://www.sonatype.com/products/maven/ documentation/book-defguide Maven repository browser: http://mvnrepository.com
  • Resources Official site: http://maven.apache.org Maven, the Definitive Guide: http://www.sonatype.com/products/maven/ documentation/book-defguide Maven repository browser: http://mvnrepository.com Miscellaneous: http://delicious.com/daneel_r_olivaw/maven