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/22 09:30:46 UTC
[48/50] [abbrv] karaf git commit: [KARAF-4657] karaf-maven-plugin now
attach an unique artifact. This closes #214
[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/e61a8260
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e61a8260
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e61a8260
Branch: refs/heads/master
Commit: e61a8260a93fd99aa87420b1c07c27b197902a27
Parents: bc90f2d
Author: Jean-Baptiste Onofr� <jb...@apache.org>
Authored: Sun Aug 21 22:53:45 2016 +0200
Committer: Jean-Baptiste Onofr� <jb...@apache.org>
Committed: Mon Aug 22 11:29:22 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/e61a8260/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);
}