Maven  OpenSource platform Integration
Maven
Agenda <ul><li>Maven </li></ul><ul><ul><li>Philosophy </li></ul></ul><ul><ul><li>POM </li></ul></ul><ul><ul><li>Standard D...
What is Maven? <ul><li>Standardized build infrastructure </li></ul><ul><li>Build tool </li></ul><ul><li>Dependency Managem...
Maven Philosophy <ul><li>Convention over Configuration </li></ul><ul><li>Ease the build process </li></ul><ul><li>Best pra...
Project Descriptor <ul><li>POM ie Project Object Model ie pom.xml </li></ul><ul><li>Contains all metadata of a project </l...
Project Descriptor Sample <project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;  xmlns:xsi=&quot;http://www.w3.org/...
Standard Directory Layout <ul><li>src/main/java </li></ul><ul><li>src/main/resources </li></ul><ul><li>src/main/config </l...
Build Lifecycle <ul><li>3 different lifecycle </li></ul><ul><ul><li>default </li></ul></ul><ul><ul><li>clean  </li></ul></...
Plugin <ul><li>Set of goals (Mojos) </li></ul><ul><li>Plugin Goals can be bound to phases </li></ul><ul><li>Depending on p...
Plugin goal binding <plugin>   <groupId>com.mycompany</groupId>   <artifactId>some-maven-plugin</artifactId>   <executions...
Plugin goal binding user mvn install generate- sources compile test install deploy package integration- test mojo mojo moj...
Plugin sample <ul><li>Surefire </li></ul><ul><li>Release </li></ul><ul><li>Archetype </li></ul><ul><li>Checkstyle </li></u...
Packaging Type <ul><li>Specifies artifact’s type </li></ul><ul><li>Configure  default  lifecycle </li></ul><ul><li>Availab...
Dependencies <ul><li>Identified by </li></ul><ul><ul><li>groupId </li></ul></ul><ul><ul><li>artifactId </li></ul></ul><ul>...
Repository <ul><li>Contains artifacts and plugins (versioned) with associated pom </li></ul><ul><li>No more lib copies per...
Site <ul><li>Automatic website generation based on project metadata </li></ul><ul><li>Plugins can be added to generate rep...
Profile <ul><li>Allows to adapt build for a particular Environment / User </li></ul><ul><li>Defined as part of pom.xml or ...
Integration environment OpenSource
Agenda <ul><li>OpenSource  Platform </li></ul><ul><ul><li>Continuous Integration </li></ul></ul><ul><ul><li>Source Control...
Continuous Integration <ul><li>http://opensource.fastconnect.org/hudson </li></ul>
Source Control Manager <ul><li>http://opensource.fastconnect.org/svn </li></ul>
Bug/Feature Tracker <ul><li>http://opensource.fastconnect.org/redmine </li></ul>
Maven Repository <ul><li>https://opensource.fastconnect.org/archiva </li></ul>
OpenSource Licences <ul><li>GPL or LGPL </li></ul><ul><li>How to chose: http://fastconnect.org/mediawiki/index.php/OpenSou...
Maven Facilities <ul><li>Archetype </li></ul><ul><ul><li>fr.fastconnect.maven:simple-archetype:1.1 </li></ul></ul><ul><ul>...
Documentation <ul><li>http://fastconnect.org/mediawiki/index.php/Environment </li></ul><ul><li>http://fastconnect.org/medi...
Sample <ul><li>mvn archetype:generate  -DarchetypeGroupId=fr.fastconnect.maven  -DarchetypeArtifactId=simple-archetype  -D...
End
Upcoming SlideShare
Loading in...5
×

Maven Overview

8,737

Published on

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

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

No notes for slide

Maven Overview

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

×