Wednesday, May 1, 2013

Maven Quickstart

  • cls
  • mvn -version
  • mvn archetype:generate
    Try running the following commands in serial order:
  • mvn validate
  • mvn compile / mvn clean compile (-o offline mode)
  • mvn package / mvn jar:jar / mvn war:war  (To build jar/war package)
  • mvn test  (Skipping test use property -Dmaven.test.skip=true)
    Just execute the following command,
  • mvn install / mvn clean install (It will encapsulate much of the default build life-cycle)
    (including compiling, testing, packaging, and installing the artifact in the local repository)
  • mvn -o compile / mvn -o install / mvn -o test (To Work Offline -o)
  • mvn dependency:analyze (To check your project for both unnecessary dependencies)
  • mvn dependency:tree
  • mvn clean dependency:copy-dependencies package
  • mvn site
  • mvn eclipse:eclipse -Dwtpversion=2.0 (To support Eclipse ide)
  • mvn archetype:generate -Dfilter=org.apache:struts
  • mvn archetype:generate > list.txt
  • mvn -f  <other pom file>
  • mvn help:help / mvn javadoc:help / mvn eclipse:help / mvn tomcat:help....etc
    mvn help:describe -Dplugin=eclipse
- Create a Simple Java Project from Maven Template
  • mvn archetype:generate -DgroupId=com.jini -DartifactId=Hello -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
  • mvn eclipse:eclipse
  • mvn package
- Running Jar
  • java -cp target/Hello-1.0-SNAPSHOT.jar com.jini.App 
  • mvn exec:java
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>1.4</version>
      <configuration>
        <mainClass>org.dhappy.test.NeoTraverse</mainClass>
      </configuration>
    </plugin>
 - MAVEN_OPTS Environment Variable 
  • (UNIX) export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m" 
  • (Windows) set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m

No comments:

Post a Comment