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

rombert pushed a commit to annotated tag maven-launchpad-plugin-2.0.10
in repository 
https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git

commit 1f5bd24e90df7fa8d4d4c97827626c2d1ddc6027
Author: Justin Edelson <[email protected]>
AuthorDate: Mon Jan 25 21:39:32 2010 +0000

    SLING-1322 - adding check to avoid loading launchpad artifact if it's the 
same as the current
    project's
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@902985
 13f79535-47bb-0310-9956-ffa450edef68
---
 .../projectsupport/AbstractBundleListMojo.java     | 75 ++++++++++++----------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
 
b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 22ac54e..8aa3ae8 100644
--- 
a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -53,28 +53,28 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
     /**
      * The name of the directory within the output directory into which the 
base
      * JAR should be installed.
-     * 
+     *
      * @parameter default-value="resources"
      */
     protected String baseDestination;
 
     /**
      * The directory which contains the start-level bundle directories.
-     * 
+     *
      * @parameter default-value="bundles"
      */
     protected String bundlesDirectory;
 
     /**
      * The definition of the defaultBundleList artifact.
-     * 
+     *
      * @parameter
      */
     private ArtifactDefinition defaultBundleList;
 
     /**
      * The definition of the defaultBundles package.
-     * 
+     *
      * @parameter
      */
     private ArtifactDefinition defaultBundles;
@@ -86,7 +86,7 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
 
     /**
      * To look up Archiver/UnArchiver implementations
-     * 
+     *
      * @component
      */
     private ArchiverManager archiverManager;
@@ -98,7 +98,7 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
 
     /**
      * The Maven project.
-     * 
+     *
      * @parameter expression="${project}"
      * @required
      * @readonly
@@ -107,14 +107,14 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
 
     /**
      * Used to look up Artifacts in the remote repository.
-     * 
+     *
      * @component
      */
     private ArtifactFactory factory;
 
     /**
      * Location of the local repository.
-     * 
+     *
      * @parameter expression="${localRepository}"
      * @readonly
      * @required
@@ -133,7 +133,7 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
 
     /**
      * List of Remote Repositories used by the resolver.
-     * 
+     *
      * @parameter expression="${project.remoteArtifactRepositories}"
      * @readonly
      * @required
@@ -142,7 +142,7 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
 
     /**
      * Used to look up Artifacts in the remote repository.
-     * 
+     *
      * @component
      */
     private ArtifactResolver resolver;
@@ -252,7 +252,7 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
         return readBundleList(bundleListFile);
     }
 
-    
+
     protected void outputBundleList(File outputDirectory)
             throws MojoExecutionException {
         try {
@@ -273,30 +273,39 @@ public abstract class AbstractBundleListMojo extends 
AbstractMojo {
                                             bundleListFile), e);
         }
 
-        try {
-            Artifact artifact = getArtifact(defaultBundleList.getGroupId(),
-                    defaultBundleList.getArtifactId(), defaultBundleList
-                            .getVersion(), defaultBundleList.getType(),
-                    defaultBundleList.getClassifier());
-            getLog().info(
-                    "Using bundle list file from "
-                            + artifact.getFile().getAbsolutePath());
-            BundleList bundles = readBundleList(artifact.getFile());
-            copyBundles(bundles, outputDirectory);
-            return;
-        } catch (Exception e) {
-            getLog()
-                    .warn(
-                            "Unable to load bundle list from artifact. Falling 
back to bundle jar",
-                            e);
+        if (!isCurrentArtifact(defaultBundleList)) {
+            try {
+                Artifact artifact = getArtifact(defaultBundleList.getGroupId(),
+                        defaultBundleList.getArtifactId(), defaultBundleList
+                                .getVersion(), defaultBundleList.getType(),
+                        defaultBundleList.getClassifier());
+                getLog().info(
+                        "Using bundle list file from "
+                                + artifact.getFile().getAbsolutePath());
+                BundleList bundles = readBundleList(artifact.getFile());
+                copyBundles(bundles, outputDirectory);
+                return;
+            } catch (Exception e) {
+                getLog()
+                        .warn(
+                                "Unable to load bundle list from artifact. 
Falling back to bundle jar",
+                                e);
+            }
         }
 
-        Artifact defaultBundlesArtifact = getArtifact(defaultBundles
-                .getGroupId(), defaultBundles.getArtifactId(), defaultBundles
-                .getVersion(), defaultBundles.getType(), defaultBundles
-                .getClassifier());
-        unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
-                "META-INF/**");
+        if (!isCurrentArtifact(defaultBundleList)) {
+            Artifact defaultBundlesArtifact = getArtifact(defaultBundles
+                    .getGroupId(), defaultBundles.getArtifactId(),
+                    defaultBundles.getVersion(), defaultBundles.getType(),
+                    defaultBundles.getClassifier());
+            unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
+                    "META-INF/**");
+        }
+    }
+
+    private boolean isCurrentArtifact(ArtifactDefinition def) {
+        return (def.getGroupId().equals(project.getGroupId()) && def
+                .getArtifactId().equals(project.getArtifactId()));
     }
 
     private void copyBundles(BundleList bundles, File outputDirectory)

-- 
To stop receiving notification emails like this one, please contact
"[email protected]" <[email protected]>.

Reply via email to