Maven的snapshot是什麼?

Basically, while developing a large scale application, the process involves a series of changes to be made in the application till it is confirmed to be ready as a final release. Because, there could be multiple teams working on an application across different set of modules.

基本上,當開發一個大型的可伸縮的應用時,過程中這個應用需要做一系列的修改直到它被確認可以作爲一個最終的release版本。因爲,有可能有多個team交叉的開發同一個應用的不同模塊。

Consider 2 teams A & B working on 2 different modules and say team B will be dependent on the services provided by team A. Say team A is involved in working on some major critical fixes and those fixes will be checked in every day. So team B has to be notified in a way that there are still some pending work by team A and the final version has not yet been released by the team A. This is where the maven's SNAPSHOT comes into the picture.

比如2個team A和B工作在兩個不同的模塊上進行開發,team B依賴於

Snapshot is a special version which indicates the current development copy of the project which is being worked on. For each build, maven always checks out for a SNAPSHOT of the project.

Hence, whenever maven finds a newer SNAPSHOT of the project, it downloads and replaces the older .jar file of the project in the local repository.

Snapshot version always gets some updates/changes being made on the project. Also, Snapshot should exist only during development phase and it will not be having a release version. This implies that the build of the project will be changed at any time and it is still under the development process.


Snapshot Vs Version

In case of SNAPSHOT, Maven will automatically fetch the latest SNAPSHOT (data-service: 1.0-SNAPSHOT) every time

CoreJavaTutorials project is built.

假如是SNAPSHOT,Maven將在每次CoreJavaTutorials項目被build時自動獲取最新版本SNAPSHOT。

In case of Version, maven once downloaded the mentioned version say JavaSamples:1.0, then it will never try to download a newer

1.0 available in repository. To download the updated code, CoreJavaTutorials version is to be upgraded to 1.1.

假如是普通的Version,Maven一旦下載了標明的版本(比方說是1.0),就不再嘗試下載一個較新的有效的1.0版本到repository中了。如果要下載更新的代碼,CoreJavaTutorials 版本將被升級到1.1

<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>CoreJavaTutorials</groupId>
   <artifactId>CoreJavaTutorials</artifactId>
   <version>1.0-SNAPSHOT</version>
   <packaging>jar</packaging>
   <url>http://maven.apache.org</url>
</project>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章