0. Maven Guide
http://maven.apache.org/guides/index.html
1. 生成eclipse工程
mvn eclipse:eclipse -DdownloadSources
2. 创建maven工程
mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.my.app -DartifactId=my
3. 生成sources包
mvn source:aggregate
4. 创建create archetype
mvn archetype:create-from-project -Darchetype.filteredExtensions=java
cd target/generated-sources/archetype/
mvn install
5. 使用本地archetype创建工程 use own archetype
mvn archetype:generate -DarchetypeCatalog=local
6. Using Maven using own folder structure
http://www.coderanch.com/t/109200/tools/Maven-own-folder-structure
<build>
. . .
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
. . .
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
</configuration>
</plugin>
</plugins>
. . .
</build>
7. install artifact to local repo
mvn install:install-file -DgroupId=org.example -DartifactId=test -Dversion=1.0.2 -Dpackaging=jar -Dfile=/path/to/file
8. if you host your own repository you can deploy the file there
mvn deploy:deploy-file -DgroupId=org.example -DartifactId=test -Dversion=1.0.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
8.1 deploy the file to localhost repo
http://stackoverflow.com/questions/5597099/maven-add-jars-through-systempath-system-but-not-added-to-war-or-anywhere-else
mvn deploy:deploy-file -DgroupId=org.apache.cxf -DartifactId=cxf -Dversion=2.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=file://%LOCAL_MAVEN_REPO%/ -DrepositoryId="some.id"
8.2 deploy the file to localhost repo with source and javadoc
mvn deploy:deploy-file -DgroupId=org.apache.cxf -DartifactId=cxf -Dversion=2.2.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=file://%LOCAL_MAVEN_REPO%/ -DrepositoryId="some.id" -Dsources=/path/to/file-sources.jar -Djavadoc=/path/to/file-javadoc.jar
8.3 if you can't upload the source and javadoc file, try the old style
http://stackoverflow.com/questions/7487130/deploying-an-artifact-its-sources-and-javadoc-using-mavens-deploydeploy-file
To deploy source jar use:
mvn deploy:deploy-file -Dfile=whack-1.0.0-sources.jar \
-Dclassifier=sources
-DgroupId=org.igniterealtime \
-DartifactId=whack \
-Dversion=1.0.0 \
-Dpackaging=jar \
-Durl=https://myhost.com/nexus/content/repositories/thirdparty/
and javadoc jar:
mvn deploy:deploy-file -Dfile=whack-1.0.0-javadoc.jar \
-Dclassifier=javadoc
-DgroupId=org.igniterealtime \
-DartifactId=whack \
-Dversion=1.0.0 \
-Dpackaging=jar \
-Durl=https://myhost.com/nexus/content/repositories/thirdparty/
9. package配置参考
http://maven.apache.org/plugins/maven-jar-plugin/usage.html
10. build配置参考
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
11. Maven Assembly plugin
Predefined Assembly Descriptors
http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html
Examples
http://maven.apache.org/plugins/maven-assembly-plugin/examples/index.html
12. Introduction to the Build Lifecycle
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
99. 未整理
(1). Building For Different Environments with Maven 2
http://maven.apache.org/guides/mini/guide-building-for-different-environments.html
(2). guide-using-one-source-directory.html
http://maven.apache.org/guides/mini/guide-using-one-source-directory.html
(3). Introduction to the POM
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
(4). Assembly samples
http://maven.apache.org/plugins/maven-assembly-plugin/examples/index.html
(5).Introduction to the Build Lifecycle
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
(6). maven-assembly-plugin
http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html