SLING-6484 for SNAPSHOT versions really reinstall every time a new package has been...
authorKonrad Windszus <kwin@apache.org>
Fri, 27 Jan 2017 08:36:20 +0000 (08:36 +0000)
committerKonrad Windszus <kwin@apache.org>
Fri, 27 Jan 2017 08:36:20 +0000 (08:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1780517 13f79535-47bb-0310-9956-ffa450edef68

src/main/java/org/apache/sling/installer/factory/packages/impl/PackageTransformer.java

index 550ce20..ee49568 100644 (file)
@@ -215,12 +215,16 @@ public class PackageTransformer implements ResourceTransformer, InstallTaskFacto
                     return;
                 }
 
-                // check if package was installed in the meantime
-                if (pkg.isInstalled()) {
-                    String message = MessageFormat.format("Package {0} was installed externally. Marking as installed.", pkgId);
-                    logger.info(message);
-                    this.setFinishedState(ResourceState.INSTALLED, null, message);
-                    return;
+                // if this is a SNAPSHOT version we always trigger a reinstall 
+                // (this workaround can be removed once https://issues.apache.org/jira/browse/JCRVLT-155 is implemented)
+                if (!pkgId.getVersionString().endsWith("-SNAPSHOT")) {
+                    // check if package was installed previously by some other means (or even by a previous run of the installer)
+                    if (pkg.isInstalled()) {
+                        String message = MessageFormat.format("Package {0} was installed externally. Marking as installed.", pkgId);
+                        logger.info(message);
+                        this.setFinishedState(ResourceState.INSTALLED, null, message);
+                        return;
+                    }
                 }
 
                 // check if dependencies are installed