Maven学习5之eclipse下 maven package运行和scope理解


1.run as->maven build,在goals输入package,别选择select,我的卡死了

运行记录:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building MavenLearning 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ MavenLearning ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\all\eclipse432\MavenLearning\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ MavenLearning ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ MavenLearning ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\all\eclipse432\MavenLearning\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MavenLearning ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ MavenLearning ---
[INFO] Surefire report directory: D:\all\eclipse432\MavenLearning\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.xubo.maven.MavenLearning.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.039 sec

Results :

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

[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MavenLearning ---
[INFO] Building jar: D:\all\eclipse432\MavenLearning\target\MavenLearning-0.0.1-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.110 s
[INFO] Finished at: 2016-05-09T20:39:49+08:00
[INFO] Final Memory: 13M/166M
[INFO] ------------------------------------------------------------------------

packaget后在target中就能找到对应的包


2.scope:

1、test范围指的是测试范围有效,在编译和打包时都不会使用这个依赖
2、compile范围指的是编译范围有效,在编译和打包时都会将依赖存储进去
3、provided依赖:在编译和测试的过程有效,最后生成war包时不会加入,诸如:servlet-api,因为servlet-api,tomcat等web服务器已经存在了,如果再打包会冲突
4、runtime在运行的时候依赖,在编译的时候不依赖
 
 
默认的依赖范围是compile


你可能感兴趣的:(maven,Ma,package运行和scop)