POM文件AEM/CQ中的SNAPSHOT有什么用?

What is the use of SNAPSHOT in POM file AEM/CQ?

这是一个非常基本的问题,但是当我们将后缀 SNAPSHOT 添加到 AEM 项目的 POM.xml 文件中时,究竟会发生什么?

<version>1.0.0-SNAPSHOT</version>

<version>1.0.0</version>

我想问的是 AEM 中使用的 OSGi 容器 Apache Felix 的行为。 我相信这与是否将捆绑包作为新鲜捆绑包进行拾取有关。

添加 SNAPSHOT 后缀以指示在开发阶段将新版本部署到 Maven repository.Usually 如果开发人员配置 pom.xml 以通过添加依赖项标记和最新版本获取最新代码,这将获取他们是存储库中的最新版本。

如果存在多个具有相同符号名称的包,OSGi 安装程序总是尝试安装最高版本的包。

但是,当您 重新安装 具有发布版本(而非快照)的现有捆绑软件时,OSGi 安装程序将忽略该捆绑软件,即使该捆绑软件中有更改也是如此.

然而,如果您重新安装具有快照版本的捆绑包,OSGi 安装程序将使用所有新更改更新捆绑包。

Apache Sling OSGi 安装程序的

Bundle Handling section 将对此提供更多见解。

来自 http://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN401

SNAPSHOT version references enable Maven to fetch the most recently deployed instance of the SNAPSHOT dependency at a dependent project build time. Note that the SNAPSHOT changes constantly. Whenever an agent deploys the artifact, it is updated in the shared repository. The SNAPSHOT dependency is refetched, on a developer's machine or it is updated in every build. This ensures that dependencies are updated and integrated with the latest changes without the need for changes to the project dependency reference configuration.

持续集成

Continuous build servers that include the ability to define and execute a job based on a Maven project, such as Hudson, can be configured to recognize when a SNAPSHOT artifact is updated and then rebuild projects that have a dependency on the updated artifact.

对于 OSGI 安装程序,它只会安装新版本。但是对于带有快照限定符的包,它无论如何都会安装。

来源:sling.apache.org/documentation/bundles/osgi-installer.html#versions-and-snapshots