Apache Maven



Commands



> mvn --version

> mvn archetype:create -DgroupId=org.wisdomfish.tcm -DartifactId=WisdomFish.ORG-TCM

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-archetype-plugin:2.0-alpha-4:create (default-cli) @ standalone-pom ---
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: org.wisdomfish.tcm
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: maven-archetype-quickstart:RELEASE
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: org.wisdomfish.tcm
[INFO] Parameter: packageName, Value: org.wisdomfish.tcm
[INFO] Parameter: package, Value: org.wisdomfish.tcm
[INFO] Parameter: artifactId, Value: WisdomFish.ORG-TCM
[INFO] Parameter: basedir, Value: /Users/ChaoYi/mvnProjects
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] ********************* End of debug info from resources from generated POM ***********************
[INFO] OldArchetype created in dir: /Users/ChaoYi/mvnProjects/WisdomFish.ORG-TCM
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.500s
[INFO] Finished at: Fri Jul 23 20:22:40 CST 2010
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
Win95:mvnProjects ChaoYi$ 


WisdomFish.ORG-TCM/


main/.../App.java
test/.../App

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>org.wisdomfish.tcm</groupId>
  <artifactId>WisdomFish.ORG-TCM</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>WisdomFish.ORG-TCM</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

project -- Maven pom.xml files 的 root element.
modelVersion -- POM 的版本號.
groupId -- project 的 unique identifier.
artifactId -- project 的基名, 用來產生檔案所需的基名. 如 myapp-1.0.jar.
packaging -- 產生的 package 類型, (e.g. JAR, WAR, EAR, etc.)
version -- project 的版本號.
name -- project 的顯示名稱.
url -- project 的網址.


> mvn compile

target/classes/...*


> mvn test
[INFO] Surefire report directory: /Users/ChaoYi/mvnProjects/WisdomFish.ORG-TCM/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.wisdomfish.tcm.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.119 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

target/
surefire-reports/
test-classes/

> mvn packget
[INFO] Building jar: /Users/ChaoYi/mvnProjects/WisdomFish.ORG-TCM/target/WisdomFish.ORG-TCM-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.459s
[INFO] Finished at: Fri Jul 23 21:03:40 CST 2010
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------


> mvn install
> mvn site
> mvn clean







Default Local Re


http://joeyta.blogspot.com/2006/07/apache-mavenproject-management.html

http://mvnrepository.com/

http://blog.csdn.net/arvinzhuo/archive/2009/06/03/4238126.aspx
http://www.javaworld.com.tw/jute/post/view?bid=11&id=236496&sty=1&tpg=9&age=0

Nexus Server
http://nexus.sonatype.org/license.html
http://www.gzweix.com/article/sort0247/sort0379/sort0380/info-149935_4.html

References




Comments