karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject [karaf] branch karaf-4.2.x updated: [KARAF-6232] Introduce timestampedSnapshot parameter in karaf:add-to-repository to define the SNAPSHOT version format
Date Wed, 17 Apr 2019 13:20:31 GMT
This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
     new 3039eff  [KARAF-6232] Introduce timestampedSnapshot parameter in karaf:add-to-repository
to define the SNAPSHOT version format
3039eff is described below

commit 3039eff80745601df35d848edb262129aaf2fbb4
Author: Jean-Baptiste Onofré <jbonofre@apache.org>
AuthorDate: Wed Apr 17 14:02:40 2019 +0200

    [KARAF-6232] Introduce timestampedSnapshot parameter in karaf:add-to-repository to define
the SNAPSHOT version format
---
 .../src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc |  4 ++++
 .../apache/karaf/tooling/features/AddToRepositoryMojo.java    |  5 ++++-
 .../main/java/org/apache/karaf/tooling/utils/MavenUtil.java   | 11 ++++++++---
 3 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/manual/src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc b/manual/src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc
index 19baf1e..bab060b 100644
--- a/manual/src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc
+++ b/manual/src/main/asciidoc/developer-guide/karaf-maven-plugin.adoc
@@ -368,6 +368,10 @@ into the `target/features-repo` directory.
 |`repository`
 |`File`
 |The directory where the bundles will be copied by the plugin goal
+
+|`timestampedSnapshot`
+|`boolean`
+|For SNAPSHOT artifacts, if false we use the base version (foo-1.0-SNAPSHOT), else we use
the timestamped version (foo-1.0-2019xxxx). Default value: false
 |===
 
 ===== `karaf:create-kar`
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
index dfa9447..54f4321 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/features/AddToRepositoryMojo.java
@@ -54,6 +54,9 @@ public class AddToRepositoryMojo extends AbstractFeatureMojo {
     @Parameter
     protected List<CopyFileBasedDescriptor> copyFileBasedDescriptors;
 
+    @Parameter(defaultValue = "false")
+    private boolean timestampedSnapshot;
+
     public void execute() throws MojoExecutionException, MojoFailureException {
         Set<Feature> featuresSet = resolveFeatures();
         
@@ -129,7 +132,7 @@ public class AddToRepositoryMojo extends AbstractFeatureMojo {
      */
     private String getRelativePath(Artifact artifact) {
         String dir = (this.flatRepoLayout) ? "" : MavenUtil.getDir(artifact);
-        String name = MavenUtil.getFileName(artifact);
+        String name = MavenUtil.getFileName(artifact, timestampedSnapshot);
         return dir + name;
     }
 
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/MavenUtil.java
b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/MavenUtil.java
index 9c4c427..e93a799 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/MavenUtil.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/utils/MavenUtil.java
@@ -207,9 +207,14 @@ public class MavenUtil {
         metadataWriter.write(writer, metadata);
     }
     
-    public static String getFileName(Artifact artifact) {
-        return artifact.getArtifactId() + "-" + artifact.getVersion()
-            + (artifact.getClassifier() != null ? "-" + artifact.getClassifier() : "") +
"." + artifact.getType();
+    public static String getFileName(Artifact artifact, boolean timestampedSnapshot) {
+        if (timestampedSnapshot) {
+            return artifact.getArtifactId() + "-" + artifact.getVersion()
+                    + (artifact.getClassifier() != null ? "-" + artifact.getClassifier()
: "") + "." + artifact.getType();
+        } else {
+            return artifact.getArtifactId() + "-" + artifact.getBaseVersion()
+                    + (artifact.getClassifier() != null ? "-" + artifact.getClassifier()
: "") + "." + artifact.getType();
+        }
     }
 
     public static String getDir(Artifact artifact) {


Mime
View raw message