Your SlideShare is downloading. ×
Maven Overview
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Maven Overview

7,139

Published on

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,139
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
0
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Maven OpenSource platform Integration
  • 2. Maven
  • 3. Agenda
    • Maven
      • Philosophy
      • POM
      • Standard Directory Layout
      • Lifecycle
      • Plugins
      • Dependencies
      • Release
      • Repository
      • Archetype
      • Site
  • 4. What is Maven?
    • Standardized build infrastructure
    • Build tool
    • Dependency Management tool
    • Quality tool
    • OpenSource Apache project
  • 5. Maven Philosophy
    • Convention over Configuration
    • Ease the build process
    • Best practises patterns
    • Consistent build
  • 6. Project Descriptor
    • POM ie Project Object Model ie pom.xml
    • Contains all metadata of a project
      • Name
      • Packaging Type
      • Dependencies
      • Tool links (CI, SCM, Bug Tracker…)
      • License
      • People
    • One POM == One Artifact
    • POM relationships
      • Inheritance
      • Aggregation
  • 7. Project Descriptor Sample <project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;> <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>4.5</version> <scope>test</scope> </dependency> </dependencies> </project>
  • 8. Standard Directory Layout
    • src/main/java
    • src/main/resources
    • src/main/config
    • src/test/java
    • src/test/resources
    • src/site
    • target
  • 9. Build Lifecycle
    • 3 different lifecycle
      • default
      • clean
      • site
    • Phases (lifecycle default)
      • validate
      • compile
      • test
      • package
      • integration-test
      • verify
      • install
      • deploy
    • Invoked with ‘mvn’ command line
  • 10. Plugin
    • Set of goals (Mojos)
    • Plugin Goals can be bound to phases
    • Depending on packaging type a list of goals are assigned to phases
  • 11. Plugin goal binding <plugin> <groupId>com.mycompany</groupId> <artifactId>some-maven-plugin</artifactId> <executions> <execution> <phase>process-test-resources</phase> <configuration>…</configuration> <goals> <goal>someGoal</goal> </goals> </execution> </executions> </plugin>
  • 12. Plugin goal binding user mvn install generate- sources compile test install deploy package integration- test mojo mojo mojo mojo mojo bindings
  • 13. Plugin sample
    • Surefire
    • Release
    • Archetype
    • Checkstyle
    • Findbugs
    • Cargo (Application Server Deployment)
    • Eclipse
    • Groovy
    • Native
  • 14. Packaging Type
    • Specifies artifact’s type
    • Configure default lifecycle
    • Available types
      • jar
      • war
      • rar
      • ear
      • ejb / ejb3
      • maven-plugin (extends jar to install plugin in maven repository)
      • pom
    • Default packaging is jar
  • 15. Dependencies
    • Identified by
      • groupId
      • artifactId
      • version
      • scope
    • Scope affects dependencies transitivity and build classpath
    • Available scope
      • compile
      • provided
      • runtime
      • test
  • 16. Repository
    • Contains artifacts and plugins (versioned) with associated pom
    • No more lib copies per project
    • Allows reproduceable builds
    • Official remote repositories available; new ones can be added
    • Local repository caches artifacts and allows offline builds
  • 17. Site
    • Automatic website generation based on project metadata
    • Plugins can be added to generate report (surefire, checkstyle, findbugs…)
    • Documentation can be written in several languages
  • 18. Profile
    • Allows to adapt build for a particular Environment / User
    • Defined as part of pom.xml or user settings.xml
    • Can be active by default or activated based on conditions or enabled on command line
  • 19. Integration environment OpenSource
  • 20. Agenda
    • OpenSource Platform
      • Continuous Integration
      • Source Control Manager
      • Bug/Feature Tracker
      • Maven Repository
      • Maven Facilities
  • 21. Continuous Integration
    • http://opensource.fastconnect.org/hudson
  • 22. Source Control Manager
    • http://opensource.fastconnect.org/svn
  • 23. Bug/Feature Tracker
    • http://opensource.fastconnect.org/redmine
  • 24. Maven Repository
    • https://opensource.fastconnect.org/archiva
  • 25. OpenSource Licences
    • GPL or LGPL
    • How to chose: http://fastconnect.org/mediawiki/index.php/OpenSource_License
  • 26. Maven Facilities
    • Archetype
      • fr.fastconnect.maven:simple-archetype:1.1
      • fr.fastconnect.maven:openspaces-archetype:1.1
    • Parent POM
      • fr.fastconnect.maven:parent:1.1
    • Skin
      • fr.fastconnect.maven:simple-skin:1.0
    • Common
      • fr.fastconnect:common:0.6
  • 27. Documentation
    • http://fastconnect.org/mediawiki/index.php/Environment
    • http://fastconnect.org/mediawiki/index.php/Maven
    • http://fastconnect.org/mediawiki/index.php/Java_Project_Life_cycle
    • http://fastconnect.org/mediawiki/index.php/Category:Maven_Plugin
    • http://fastconnect.org/mediawiki/index.php/Subversion
  • 28. Sample
    • mvn archetype:generate -DarchetypeGroupId=fr.fastconnect.maven -DarchetypeArtifactId=simple-archetype -DarchetypeVersion=1.0 -DartifactId=test –DgroupId=fr.fastconnect
    • cd test
    • mvn license:format -Dlicense.type=gpl
    • mvn verify -Dlicense.type=gpl
    • mvn eclipse:eclipse
    • mvn site
    • cd target/site
  • 29. End

×