2. Agenda Definition and origines Ant VS Maven The POM file Maven plugins Maven archetypes Repositories Dependency Management Lifecycle A quick demo Q&A No. 2 08 September 2009 Title of Presentation
3. No. 3 08 September 2009 Title of Presentation Definition and origines What is Maven The Maven aim The current version How it comes to us? Brief History The creator of Maven (Turbine) Compilation Deployment Validation Maven Site Dependency Documentation
4. No. 4 08 September 2009 Title of Presentation Ant VS Maven : the advantages of Maven VS Versioningmanaged by Maven Maven provides conventions Extensibility, reusability Better quality in deliveries Less time spent
5. No. 5 08 September 2009 Title of Presentation The POM What is Maven POM? Anatomy of a basic POM <project> <modelVersion>1.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> Project
10. MavenRepositories No. 8 08 September 2009 Title of Presentation groupId |-- artifactId |--- version |-- artifactId-version.pom Local repositorycontainsartifactsusedso far Remoterepositoryis a global artifactswarehouse on a remote server
11. Dependency Management How maven manage dependencies? Transitive dependency. Dependency scope No. 9 08 September 2009 Title of Presentation <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope> test</scope> </dependency> </dependencies>
15. Simple Actions or Goals.No. 10 08 September 2009 Title of Presentation Lifecycle Phase II Phase II Default Phase I Phase II Phase II clean Phase I Phase II Phase II Site Phase I
16. Demo No. 11 08 September 2009 Title of Presentation
17. Q&A No. 12 08 September 2009 Title of Presentation
Notas do Editor
C’est quoi une dépendance?Une dépendance est une référence vers un artefact spécifique contenu dans un repository. Maven offre une gestion transitive de dépendance : c’est-à-dire que si vous avez besoin d’une librairie dans votre projet et que cette librairies dépends de plusieurs autres, vous n’avez qu’à indiquer le nom de cette librairie et sa version, et Maven se charge du reste.le scope définie la phase du projet ou sera disponible cette dépendance
Repo local vide, afficher le repoMvnarchetype:generate#15, afficher le repoMvn testModifie POM: Ajouterunedépendance<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.0-FINAL</version> </dependency>Dans App.java:import org.apache.poi.hssf.usermodel.HSSFWorkbook;EtHSSFWorkbookwb = new HSSFWorkbook();Mvncompiler:compileAjouter un plugin (javadoc reporting)<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.5</version> </plugin> </plugins> </reporting>Mvnjavadoc:javadocGénérer site/doc: mvn siteIntégration IDE: mvneclipse:eclipse