You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2016/08/21 20:54:41 UTC
karaf git commit: [KARAF-4657] karaf-maven-plugin now attach an
unique artifact. This closes #214
Repository: karaf
Updated Branches:
refs/heads/master 18b0494b6 -> 0a1e84a29
[KARAF-4657] karaf-maven-plugin now attach an unique artifact. This closes #214
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/0a1e84a2
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/0a1e84a2
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/0a1e84a2
Branch: refs/heads/master
Commit: 0a1e84a2918e022cf1092967e1a1f9cacd5b0c02
Parents: 18b0494
Author: Jean-Baptiste Onofr� <jb...@apache.org>
Authored: Sun Aug 21 22:53:45 2016 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Sun Aug 21 22:53:45 2016 +0200
----------------------------------------------------------------------
.../main/java/org/apache/karaf/tooling/ArchiveMojo.java | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/0a1e84a2/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
----------------------------------------------------------------------
diff --git a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
index de8b093..efbf370 100644
--- a/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
+++ b/tooling/karaf-maven-plugin/src/main/java/org/apache/karaf/tooling/ArchiveMojo.java
@@ -133,6 +133,16 @@ public class ArchiveMojo extends MojoSupport {
private void archive(String type) throws IOException {
Artifact artifact1 = factory.createArtifactWithClassifier(project.getArtifact().getGroupId(), project.getArtifact().getArtifactId(), project.getArtifact().getVersion(), type, "bin");
File target1 = archive(targetServerDirectory, destDir, artifact1);
+
+ // artifact1 is created with explicit classifier "bin", which is dropped below when attachArtifact is called
+ // which means we can't use artifact1.equals(artifact) directly with artifact1
+ Artifact artifact2 = factory.createArtifact(artifact1.getGroupId(), artifact1.getArtifactId(), artifact1.getVersion(), artifact1.getScope(), artifact1.getType());
+ for (Artifact artifact : project.getAttachedArtifacts()) {
+ if (artifact2.equals(artifact)) {
+ getLog().debug("Artifact " + artifact2 + " already attached");
+ return;
+ }
+ }
if (attach) {
projectHelper.attachArtifact(project, artifact1.getType(), classifier, target1);
}