<groupId>net.biancheng.www</groupId> <artifactId>helloMaven</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version>
mvn clean package -U
区别 | SNAPSHOT 版本 | RELEASE 版本 |
---|---|---|
定义 | 版本号中带有 -SNAPSHOT | 版本号中不带有 -SNAPSHOT |
发布仓库 | Snapshot 快照仓库 | Release 发行仓库 |
是否从远程仓库自动获取更新 | 在不更改版本号的前提下,直接编译打包时,Maven 会自动从远程仓库上下载最新的快照版本。 | 在不更改版本号的前提下,直接编译打包时,如果本地仓库已经存在该版本的模块,则 Maven 不会主动去远程仓库下载。 |
稳定性 | 快照版本往往对应了大量带有时间戳的构件,具有不稳定性。 | 发布版本只对应了唯一的构件,具有稳定性。 |
使用场景 | 快照版本只应该在组织内部的项目中依赖使用。 | Maven 项目使用的组织外的依赖项都应该时发布版本的,不应该使用任何的快照版本依赖,否则会造成潜在的风险。 |
发布前是否需要修改 | 当项目经过完善的测试后,需要上线时,应该将项目从快照版本更改为发布版本 | 不需要修改 |
mvn clean package -U
[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for net.biancheng.www:secondMaven:jar:1.0-SNAPSHOT [WARNING] 'dependencies.dependency.systemPath' for net.biancheng.www:helloMaven:jar should use a variable instead of a hard-coded path D:\maven\helloMaven\target\helloMaven-1.0-SNAPSHOT.jar @ line 37, column 16 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] -------------------< net.biancheng.www:secondMaven >-------------------- [INFO] Building secondMaven 1.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ secondMaven --- [INFO] Deleting D:\maven\secondMaven\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ secondMaven --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\maven\secondMaven\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ secondMaven --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 1 source file to D:\maven\secondMaven\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ secondMaven --- [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\maven\secondMaven\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ secondMaven --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent! [INFO] Compiling 1 source file to D:\maven\secondMaven\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ secondMaven --- [INFO] Surefire report directory: D:\maven\secondMaven\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running net.biancheng.www.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.008 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ secondMaven --- [INFO] Building jar: D:\maven\secondMaven\target\secondMaven-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.413 s [INFO] Finished at: 2021-03-04T10:24:32+08:00 [INFO] ------------------------------------------------------------------------
本文链接:http://task.lmcjl.com/news/18652.html