Basics
set MAVEN_HOME
mvn install
mvn clean install
mvn package -Dmaven.test.skip=true
mvn surefire-report:report mvnrepository.com
It downloads the repository to c:\Documents and Settings\[USER]\.m2\repository
Intermediate
Setting up maven based projects into eclipse
Eclipse needs to find the Maven-downloaded jars for compilation.
Under Preferences > Java > Build Path > Classpath Variable M2_REPO should be set to ..\.m2\repository
Run mvn eclipse:clean --- dletes .class and .project files
mvn eclipse:eclipse --- creates .class and .project files using pom.xml (recursively)
Thats it.
Advanced
Steps to create an archetype project:
Use below to create a sample archetype meta project.
/>mvn archetype:create -DgroupId=[com.biomedcentral] -DartifactId=[archetype-spring-jar] -DarchetypeArtifactId=maven-archetype-archetype
Update the archetype [archetype-spring-jar]\src\main\resources\META-INF\maven\archetype.xml
Keep all the relevant resource in the [archetype-spring-jar]\src\main\resources\archetype-resources\... and update the archetype with its reference.
Install the archetype project itself:
/>mvn install
Now time to use this project generator:
mvn archetype:create -DarchetypeGroupId=-DarchetypeArtifactId= Very useful-DarchetypeVersion= -DgroupId= -DartifactId=
This is amazing...From an existing architecture u can clone yours ...
A sample command using above for spring hibernate is below:
#mvn archetype:generate -DarchetypeGroupId=com.webtide -DarchetypeArtifactId=maven-archetype-SpringJpa -DarchetypeVersion=1.0 -DgroupId=c
om.my.package -DartifactId=ImageLibraryCategoryManager
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create -DgroupId=com.my -DartifactId=springmvc-hibernate-app -DarchetypeArtifactId=appfuse-basic-spring -DarchetypeGroupId=org.appfuse.archetypes
A bit on Maven Plugins:
1. maven-dependency-plugin : http://maven.apache.org/plugins/maven-dependency-plugin/
for copying dependency jars for a standalone app,etc.
Reference:
http://mevenide.codehaus.org/ -- plugin for eclipse
http://maven.apache.org/guides/mini/guide-attached-tests.html
http://www.webtide.com/resources.jsp --samples
For springmvc-hibernate archetypes use http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
http://maven.apache.org/guides/mini/guide-creating-archetypes.html
Debug maven : http://tech.puredanger.com/2009/02/25/maven-tips/
Wednesday, July 9, 2008
Maven - an expert .
Posted on 7:10 PM by Unknown
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment