1

This is a very basic question but what exactly happens when we add suffix SNAPSHOT to POM.xml file of an AEM project?

<version>1.0.0-SNAPSHOT</version>

<version>1.0.0</version>

I am asking with respect to the behavior of the OSGi container Apache Felix used in AEM. I believe this has something to do with picking up of bundles as fresh bundle or not.

Oliver
  • 6,152
  • 2
  • 42
  • 75
  • Possible duplicate of [What exactly is a Maven Snapshot and why do we need it?](https://stackoverflow.com/questions/5901378/what-exactly-is-a-maven-snapshot-and-why-do-we-need-it) – Abhishek Sep 28 '17 at 21:50

3 Answers3

6

The OSGi installer always tries to install the highest version of a bundle if several bundles with same symbolic name is present.

However, when you reinstall an existing bundle which has a release version (and not a snapshot), the OSGi installer would ignore the bundle even if there were changes within the bundle.

Whereas, the OSGi installer would update the bundle with all the new changes if you are reinstalling a bundle with a snapshot version.

Bundle Handling section of Apache Sling OSGi installer would give more insights on this.

rakhi4110
  • 9,253
  • 2
  • 30
  • 49
3

SNAPSHOT suffix is added to indicate a new version is deployed to the maven repository.Usually during development phase if developers configure pom.xml to get the latest code by adding dependency tag and latest version this will fetch them the latest from repository.

sherry
  • 91
  • 6
2

From 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.

For Continuous Integration

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.

For OSGI installer, it will only install new version. But for packages with snapshot qualifier, it will install anyway.

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

  • Your Answer is also correct as well but I am marking @rakhi4110 's answer as he answered first. – Oliver Sep 29 '17 at 10:23