400 likes | 636 Views
M a ven. prepared by hasan.we4tech.com. What is maven?. Java based project management tool. Automated software build management tool. Repository centric dependent library resolution. Project status reporting tool Project documenting tool Product release management tool
E N D
Maven prepared by hasan.we4tech.com
Java based project management tool. • Automated software build management tool. • Repository centric dependent library resolution. • Project status reporting tool • Project documenting tool • Product release management tool • Configuration management supporting tool
Java based project management. • Project document management. • Project status report management. • Project goal wise module separation tool. • Company wide snapshot or release repository • Better product and module centric approach. • Easy to use
Making build process much easier. • Dependency management • Centralizing module dependency. • Maintaining a standard project layout. • Generating report on broken code, broken coding convention, unit test code coverage etc…
What is POM (Project Object Model)? • What is artifact? • What is group? • What is archetype? • What is goal? • What is dependency?
Goal • mvn package • mvn compile • mvn clean • mvn test • mvn javadoc:javadoc • mvn site • …
Dependency <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies>
validate • generate-sources • process-sources • generate-resources • process-resources • compile
Create parent project POM file. • Create a new maven project • Create a web application module • Generate intelliJ IDEA project files • Packaging whole project
Create parent project POM file. <?xml version="1.0" encoding="UTF-8"?> <project> <modelVersion>4.0.0</modelVersion><groupId>com.company.project</groupId> <artifactId>project-parent</artifactId><packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <name>project name</name> <modules> <!--module>project-core</module--> </modules> <!-- somewhere in repository --> <repositories> <repository> <id>somewherein</id> <url>http://maven.somewherein.net/</url> </repository> </repositories> <dependencies> <dependency> <artifactId>xom</artifactId> <groupId>xom</groupId> <version>1.1</version> </dependency> </dependencies> </project>
Create a new maven project mvn archetype:create \ –DgroupId=com.company.project \ –DartifactId=project-core
Create a new web application module mvn archetype:create \ –DgroupId=com.company.project \ –DartifactId=project-core \ –DarchetypeArtifactId=maven-archetype-webapp
Generate intelliJ IDEA or eclipse project files mvn idea:idea Or mvn eclipse:eclipse
Packaging whole project mvn install Or mvn package
Configure somewhere repository • Go to maven_home/conf/settings.xml • Set the following line – • <localRepository>\\192.168.1.254\software\24_maven_repository</localRepository>
How to find artifact? • Search google – i.e : maven xom • Manually browse public repository • http://ibiblio.org/maven/ • http://repo1.maven.org/maven2/ • http://maven.somewherein.net • [directory indexing is not enabled]
Changes on your pom file. <ciManagement> <system>continuum</system> <notifiers> <notifier> <type>mail</type> <configuration> <address>hasan@somewherein.net</address> </configuration> </notifier> </notifiers> </ciManagement> <scm> <connection>svn://host/os/project/trunk/</connection> <developerConnection>svn://somewhereindhaka.net/os/ideabase/idea_content_repo/trunk/development</developerConnection> <tag>HEAD</tag> <url>http://somewhereindhaka.net/os/ideabase/idea_content_repo/trunk/development</url> </scm>
Go to (ask me for url) continuum server url • Login using user and password (ask me if you need user and password) • Select “maven 2.0+ project” from right side menu. • Give your maven pom file url from. i.e – http://host/svn/project/pom.xml
Thank you every one and those who brought such a nice tool