You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by an...@apache.org on 2019/08/14 20:52:52 UTC

[sling-org-apache-sling-feature-cpconverter] branch issues/SLING-8630 created (now 1d9ffc4)

This is an automated email from the ASF dual-hosted git repository.

andysch pushed a change to branch issues/SLING-8630
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git.


      at 1d9ffc4  SLING-8630 - Prevent the Converter from overwritting existing POM files

This branch includes the following new commits:

     new 1d9ffc4  SLING-8630 - Prevent the Converter from overwritting existing POM files

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[sling-org-apache-sling-feature-cpconverter] 01/01: SLING-8630 - Prevent the Converter from overwritting existing POM files

Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

andysch pushed a commit to branch issues/SLING-8630
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git

commit 1d9ffc49f159169269bb03b6e8432588762be8a8
Author: Andreas Schaefer <sc...@iMac.local>
AuthorDate: Wed Aug 14 13:52:05 2019 -0700

    SLING-8630 - Prevent the Converter from overwritting existing POM files
---
 README.md                                                  | 14 ++++++++++++++
 .../cpconverter/artifacts/DefaultArtifactsDeployer.java    |  8 ++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 2dd6c3f..c43db11 100644
--- a/README.md
+++ b/README.md
@@ -404,3 +404,17 @@ then execute the command
 ```
 $ ./bin/cp2sf @arfile
 ````
+
+## Local Maven Repo as Cache
+
+The converter will create a Maven Dependency folder structure and create a POM file
+for any converted Content Package file. This will allow subsequent Feature tools
+to find and process them.
+The **group and artifact id** of the converted Content Package and Bundles is
+taken from the file itself (Content Package's Vault Properties file, Bundle's
+Headers). Because these sources might not correspond with the CPs or Bundles
+regular Maven place the Converter will place them accordingly to the found
+data hence in a new place.
+This does not bother the Sling Feature Maven Plugin nor the Feature Launcher
+as they are still able to find the dependencies if placed in the Local
+Maven Repo.
\ No newline at end of file
diff --git a/src/main/java/org/apache/sling/feature/cpconverter/artifacts/DefaultArtifactsDeployer.java b/src/main/java/org/apache/sling/feature/cpconverter/artifacts/DefaultArtifactsDeployer.java
index 31b519b..c1dda4c 100644
--- a/src/main/java/org/apache/sling/feature/cpconverter/artifacts/DefaultArtifactsDeployer.java
+++ b/src/main/java/org/apache/sling/feature/cpconverter/artifacts/DefaultArtifactsDeployer.java
@@ -89,8 +89,12 @@ public final class DefaultArtifactsDeployer implements ArtifactsDeployer {
 
         targetFile = new File(targetDir, String.format("%s-%s.pom", id.getArtifactId(), id.getVersion()));
 
-        try (FileOutputStream targetStream = new FileOutputStream(targetFile)) {
-            new MavenPomSupplierWriter(id).write(targetStream);
+        // If a POM already exists then there is not need to overwrite it as either the entire POM is lost
+        // or if its the a file previously generated here it must be the same
+        if(!targetFile.exists()) {
+            try (FileOutputStream targetStream = new FileOutputStream(targetFile)) {
+                new MavenPomSupplierWriter(id).write(targetStream);
+            }
         }
     }