[align=center][b]写一下Maven2的学习总结[/b][/align]
[b]Maven Home[/b]
[list]
[*][url]http://maven.apache.org[/url]
[/list]
[b]Environment Configuration[/b]
[list][*]Decompress Maven [color=olive]E:\apache-maven-2.1.0[/color]
[*]Environment Variable Set [color=olive]M2_HOME = E:\apache-maven-2.1.0[/color]
[*]Path Set [color=olive]%M2_HOME%\bin[/color]
[*]Install Test
[img]/upload/attachment/88765/a5b46750-cf1d-3d81-930e-974baec386ac.gif[/img]
[/list]
[b]Maven's Principles[/b]
[list][*][color=olive]Convention over configuration[/color]
[*][color=olive]Declarative execution[/color]
[*][color=olive]Reuse of build logic[/color]
[*][color=olive]Coherent organization of dependencies[/color]
[/list]
[b]Maven's Configuration File[/b]
[list][*]User Level [color=olive]${user.home}/.m2/settings.xml[/color]
[*]Global Level [color=olive]${M2_HOME}/conf/settings.xml[/color]
[/list]
[b]Eclipse Maven Classpath Variables[/b]
[list][*][color=olive]Window -> Preferences -> Java -> Build Path -> Classpath Variables -> New Variable Entry[/color]
[*][color=olive]Name=M2_REPO -> Path -> Folder Selection -> ${user.home}/.m2/repository[/color]
[/list]
[b]Maven2 Directory[/b]
[list][*][img]/upload/attachment/88757/5184873f-7edc-384b-b158-909757a039c3.gif[/img]
[/list]
[b]Maven Command And dissect what actually happened[/b]
[b]Maven Home[/b]
[list]
[*][url]http://maven.apache.org[/url]
[/list]
[b]Environment Configuration[/b]
[list][*]Decompress Maven [color=olive]E:\apache-maven-2.1.0[/color]
[*]Environment Variable Set [color=olive]M2_HOME = E:\apache-maven-2.1.0[/color]
[*]Path Set [color=olive]%M2_HOME%\bin[/color]
[*]Install Test
[img]/upload/attachment/88765/a5b46750-cf1d-3d81-930e-974baec386ac.gif[/img]
[/list]
[b]Maven's Principles[/b]
[list][*][color=olive]Convention over configuration[/color]
[*][color=olive]Declarative execution[/color]
[*][color=olive]Reuse of build logic[/color]
[*][color=olive]Coherent organization of dependencies[/color]
[/list]
[b]Maven's Configuration File[/b]
[list][*]User Level [color=olive]${user.home}/.m2/settings.xml[/color]
[*]Global Level [color=olive]${M2_HOME}/conf/settings.xml[/color]
[/list]
[b]Eclipse Maven Classpath Variables[/b]
[list][*][color=olive]Window -> Preferences -> Java -> Build Path -> Classpath Variables -> New Variable Entry[/color]
[*][color=olive]Name=M2_REPO -> Path -> Folder Selection -> ${user.home}/.m2/repository[/color]
[/list]
[b]Maven2 Directory[/b]
[list][*][img]/upload/attachment/88757/5184873f-7edc-384b-b158-909757a039c3.gif[/img]
[/list]
[b]Maven Command And dissect what actually happened[/b]
mvn archetype:create -DgroupId=mygroup -DartifactId=myartifact
mvn archetype:create -DgroupId=mygroup -DartifactId=myartifact -DarchetypeArtifactId=maven-archetype-webapp
mvn compile
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
mvn test
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
3. [INFO] [resources:testResources]
4. [INFO] [compiler:testCompile]
5. [INFO] [surefire:test]
mvn test-compile
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
3. [INFO] [resources:testResources]
4. [INFO] [compiler:testCompile]
mvn package
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
3. [INFO] [resources:testResources]
4. [INFO] [compiler:testCompile]
5. [INFO] [surefire:test]
6. [INFO] [jar:jar]
mvn package -Dmaven.test.skip=true
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
3. [INFO] [resources:testResources]
4. [INFO] [compiler:testCompile]
5. [INFO] [surefire:test]
[INFO] Tests are skipped.
6. [INFO] [jar:jar]
mvn install
1. [INFO] [resources:resources]
2. [INFO] [compiler:compile]
3. [INFO] [resources:testResources]
4. [INFO] [compiler:testCompile]
5. [INFO] [surefire:test]
6. [INFO] [jar:jar]
7. [INFO] [install:install]
mvn clean
1. [INFO] [clean:clean]
[INFO] Deleting directory .. //(注:删除target目录)
mvn eclipse:eclipse
1. [INFO] [eclipse:eclipse]
[INFO] Adding default classpath .. //(注:生成.classpath文件)
[INFO] Wrote Eclipse project .. //(注:生成.project文件)
mvn clean eclipse:clean eclipse:eclipse -DdownloadSources=true
mvn help:effective-pom
mvn dependency:tree //(查看项目依赖树)
mvn dependency:tree | grep 'top-provider' -B20 -A5
mvn -X //show debug info