incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1136928 - in /sling/trunk/maven/maven-launchpad-plugin/src/main: java/org/apache/sling/maven/projectsupport/ resources/META-INF/ resources/META-INF/plexus/
Date Fri, 17 Jun 2011 16:41:08 GMT
Author: justin
Date: Fri Jun 17 16:41:07 2011
New Revision: 1136928

URL: http://svn.apache.org/viewvc?rev=1136928&view=rev
Log:
SLING-2105 - initial implementation of partial bundle lists

Added:
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
      - copied, changed from r1136139, sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
      - copied, changed from r1136139, sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/
    sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/
    sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/components.xml
Modified:
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
    sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
Fri Jun 17 16:41:07 2011
@@ -17,40 +17,10 @@
 package org.apache.sling.maven.projectsupport;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolver;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.execution.MavenSession;
+
 import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Reader;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import org.drools.KnowledgeBase;
-import org.drools.KnowledgeBaseFactory;
-import org.drools.builder.KnowledgeBuilder;
-import org.drools.builder.KnowledgeBuilderError;
-import org.drools.builder.KnowledgeBuilderFactory;
-import org.drools.builder.ResourceType;
-import org.drools.io.ResourceFactory;
-import org.drools.runtime.StatefulKnowledgeSession;
 
 public abstract class AbstractBundleListMojo extends AbstractMojo {
 
@@ -70,6 +40,11 @@ public abstract class AbstractBundleList
      */
     protected static final String WAR = "war";
 
+    /**
+     * Partial Bundle List type
+     */
+    protected static final String PARTIAL = "partialbundlelist";
+
     protected static final String CONFIG_PATH_PREFIX = "resources/config";
 
     protected static final String BUNDLE_PATH_PREFIX = "resources/bundles";
@@ -88,13 +63,6 @@ public abstract class AbstractBundleList
     protected File bundleListFile;
 
     /**
-     * The definition of the defaultBundleList artifact.
-     *
-     * @parameter
-     */
-    protected ArtifactDefinition defaultBundleList;
-
-    /**
      * The Maven project.
      *
      * @parameter expression="${project}"
@@ -108,275 +76,4 @@ public abstract class AbstractBundleList
      */
     protected MavenProjectHelper projectHelper;
 
-    /**
-     * Any additional bundles to include in the project's bundles directory.
-     *
-     * @parameter
-     */
-    private ArtifactDefinition[] additionalBundles;
-
-    private BundleList bundleList;
-
-    /**
-     * Bundles which should be removed from the project's bundles directory.
-     *
-     * @parameter
-     */
-    private ArtifactDefinition[] bundleExclusions;
-
-    /**
-     * Used to look up Artifacts in the remote repository.
-     *
-     * @component
-     */
-    private ArtifactFactory factory;
-
-    /**
-     * Used to look up Artifacts in the remote repository.
-     *
-     * @component hint="maven"
-     */
-    private ArtifactMetadataSource metadataSource;
-
-    /**
-     * If true, include the default bundles.
-     *
-     * @parameter default-value="true"
-     */
-    private boolean includeDefaultBundles;
-
-    /**
-     * Location of the local repository.
-     *
-     * @parameter expression="${localRepository}"
-     * @readonly
-     * @required
-     */
-    private ArtifactRepository local;
-
-    /**
-     * List of Remote Repositories used by the resolver.
-     *
-     * @parameter expression="${project.remoteArtifactRepositories}"
-     * @readonly
-     * @required
-     */
-    private List remoteRepos;
-
-    /**
-     * Used to look up Artifacts in the remote repository.
-     *
-     * @component
-     */
-    private ArtifactResolver resolver;
-
-    /**
-     * @parameter
-     */
-    private File[] rewriteRuleFiles;
-
-    /**
-     * @parameter expression="${session}
-     * @required
-     * @readonly
-     */
-    protected MavenSession mavenSession;
-
-    public final void execute() throws MojoFailureException, MojoExecutionException {
-        try {
-            initBundleList();
-        } catch (MojoExecutionException e) {
-            throw e;
-        } catch (Exception e) {
-            throw new MojoExecutionException("Unable to load dependency information from
properties file.", e);
-        }
-        executeWithArtifacts();
-
-    }
-
-    /**
-     * Execute the logic of the plugin after the default artifacts have been
-     * initialized.
-     */
-    protected abstract void executeWithArtifacts() throws MojoExecutionException, MojoFailureException;
-
-    /**
-     * Get a resolved Artifact from the coordinates found in the artifact
-     * definition.
-     *
-     * @param def the artifact definition
-     * @return the artifact, which has been resolved
-     * @throws MojoExecutionException
-     */
-    protected Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException
{
-        return getArtifact(def.getGroupId(), def.getArtifactId(), def.getVersion(), def.getType(),
def.getClassifier());
-    }
-
-    /**
-     * Get a resolved Artifact from the coordinates provided
-     *
-     * @return the artifact, which has been resolved.
-     * @throws MojoExecutionException
-     */
-    protected Artifact getArtifact(String groupId, String artifactId, String version, String
type, String classifier)
-            throws MojoExecutionException {
-        Artifact artifact;
-        VersionRange vr;
-
-        try {
-            vr = VersionRange.createFromVersionSpec(version);
-        } catch (InvalidVersionSpecificationException e) {
-            vr = VersionRange.createFromVersion(version);
-        }
-
-        if (StringUtils.isEmpty(classifier)) {
-            artifact = factory.createDependencyArtifact(groupId, artifactId, vr, type, null,
Artifact.SCOPE_COMPILE);
-        } else {
-            artifact = factory.createDependencyArtifact(groupId, artifactId, vr, type, classifier,
-                    Artifact.SCOPE_COMPILE);
-        }
-
-        // This code kicks in when the version specifier is a range.
-        if (vr.getRecommendedVersion() == null) {
-            try {
-                List availVersions = metadataSource.retrieveAvailableVersions(artifact, local,
remoteRepos);
-                ArtifactVersion resolvedVersion = vr.matchVersion(availVersions);
-                artifact.setVersion(resolvedVersion.toString());
-            } catch (ArtifactMetadataRetrievalException e) {
-                throw new MojoExecutionException("Unable to find version for artifact", e);
-            }
-            
-        }
-
-        try {
-            resolver.resolve(artifact, remoteRepos, local);
-        } catch (ArtifactResolutionException e) {
-            throw new MojoExecutionException("Unable to resolve artifact.", e);
-        } catch (ArtifactNotFoundException e) {
-            throw new MojoExecutionException("Unable to find artifact.", e);
-        }
-        return artifact;
-    }
-
-    protected BundleList getBundleList() {
-        return bundleList;
-    }
-
-    /**
-     * Hook methods for subclasses to initialize any additional artifact
-     * definitions.
-     *
-     * @param dependencies the dependency properties loaded from the JAR file
-     */
-    protected void initArtifactDefinitions(Properties dependencies) {
-    }
-
-    /**
-     * Hook methods for subclasses to initialize the bundle list.
-     */
-    protected void initBundleList(BundleList bundleList) {
-    }
-
-    protected boolean isCurrentArtifact(ArtifactDefinition def) {
-        return (def.getGroupId().equals(project.getGroupId()) && def.getArtifactId().equals(project.getArtifactId()));
-    }
-
-    /**
-     * Initialize the artifact definitions using defaults inside the plugin JAR.
-     *
-     * @throws IOException if the default properties can't be read
-     * @throws XmlPullParserException
-     * @throws MojoExecutionException
-     */
-    private final void initArtifactDefinitions() throws IOException {
-        Properties dependencies = new Properties();
-        dependencies.load(getClass().getResourceAsStream(
-                "/org/apache/sling/maven/projectsupport/dependencies.properties"));
-
-        if (defaultBundleList == null) {
-            defaultBundleList = new ArtifactDefinition();
-        }
-        defaultBundleList.initDefaults(dependencies.getProperty("defaultBundleList"));
-
-        initArtifactDefinitions(dependencies);
-    }
-
-    private final void initBundleList() throws IOException, XmlPullParserException, MojoExecutionException
{
-        initArtifactDefinitions();
-        if (isCurrentArtifact(defaultBundleList)) {
-            bundleList = readBundleList(bundleListFile);
-        } else {
-            bundleList = new BundleList();
-            if (includeDefaultBundles) {
-                Artifact defBndListArtifact = getArtifact(defaultBundleList.getGroupId(),
-                        defaultBundleList.getArtifactId(), defaultBundleList.getVersion(),
defaultBundleList.getType(),
-                        defaultBundleList.getClassifier());
-                getLog().info("Using bundle list file from " + defBndListArtifact.getFile().getAbsolutePath());
-                bundleList = readBundleList(defBndListArtifact.getFile());
-            }
-
-            if (bundleListFile.exists()) {
-                bundleList.merge(readBundleList(bundleListFile));
-            }
-        }
-        if (additionalBundles != null) {
-            for (ArtifactDefinition def : additionalBundles) {
-                bundleList.add(def.toBundle());
-            }
-        }
-        if (bundleExclusions != null) {
-            for (ArtifactDefinition def : bundleExclusions) {
-                bundleList.remove(def.toBundle(), false);
-            }
-        }
-        initBundleList(bundleList);
-
-        rewriteBundleList(bundleList);
-    }
-
-    private void rewriteBundleList(BundleList bundleList) throws MojoExecutionException {
-        if (rewriteRuleFiles != null) {
-            KnowledgeBase knowledgeBase = createKnowledgeBase(rewriteRuleFiles);
-            StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();
-            try {
-                session.setGlobal("mavenSession", mavenSession);
-                session.setGlobal("mavenProject", project);
-                session.insert(bundleList);
-                session.fireAllRules();
-            } finally {
-                session.dispose();
-            }
-        }
-    }
-
-    private KnowledgeBase createKnowledgeBase(File[] files) throws MojoExecutionException
{
-        KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
-        builder.add(ResourceFactory.newClassPathResource("drools-globals.drl", getClass()),
ResourceType.DRL);
-        for (File file : files) {
-            getLog().info("Parsing rule file " + file.getAbsolutePath());
-            builder.add(ResourceFactory.newFileResource(file), ResourceType.DRL);
-        }
-        if (builder.hasErrors()) {
-            getLog().error("Rule errors:");
-            for (KnowledgeBuilderError error : builder.getErrors()) {
-                getLog().error(error.toString());
-            }
-            throw new MojoExecutionException("Unable to create rules. See log for details.");
-        }
-
-        KnowledgeBase base = KnowledgeBaseFactory.newKnowledgeBase();
-        base.addKnowledgePackages(builder.getKnowledgePackages());
-        return base;
-    }
-
-    private BundleList readBundleList(File file) throws IOException, XmlPullParserException
{
-        BundleListXpp3Reader reader = new BundleListXpp3Reader();
-        FileInputStream fis = new FileInputStream(file);
-        try {
-            return reader.read(fis);
-        } finally {
-            fis.close();
-        }
-    }
-
 }

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
Fri Jun 17 16:41:07 2011
@@ -30,7 +30,7 @@ import org.codehaus.plexus.util.FileUtil
  * This class contains the Launchpad-framework specific utility methods.
  *
  */
-public abstract class AbstractLaunchpadFrameworkMojo extends AbstractBundleListMojo {
+public abstract class AbstractLaunchpadFrameworkMojo extends AbstractUsingBundleListMojo
{
 
     /**
      * The name of the directory within the output directory into which the base

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
Fri Jun 17 16:41:07 2011
@@ -50,7 +50,7 @@ import org.apache.sling.maven.projectsup
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
 import org.osgi.framework.BundleException;
 
-public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMojo implements
Notifiable {
+public abstract class AbstractLaunchpadStartingMojo extends AbstractUsingBundleListMojo implements
Notifiable {
 
     /** Default log level setting if no set on command line (value is "INFO"). */
     private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;

Copied: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
(from r1136139, sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java)
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java?p2=sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java&p1=sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java&r1=1136139&r2=1136928&rev=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AbstractUsingBundleListMojo.java
Fri Jun 17 16:41:07 2011
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.List;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.factory.ArtifactFactory;
@@ -34,11 +35,8 @@ import org.apache.maven.artifact.version
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectHelper;
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
 import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Reader;
 import org.codehaus.plexus.util.StringUtils;
@@ -52,7 +50,7 @@ import org.drools.builder.ResourceType;
 import org.drools.io.ResourceFactory;
 import org.drools.runtime.StatefulKnowledgeSession;
 
-public abstract class AbstractBundleListMojo extends AbstractMojo {
+public abstract class AbstractUsingBundleListMojo extends AbstractBundleListMojo {
 
     /**
      * @parameter expression="${configDirectory}"
@@ -83,11 +81,6 @@ public abstract class AbstractBundleList
     }
 
     /**
-     * @parameter default-value="${basedir}/src/main/bundles/list.xml"
-     */
-    protected File bundleListFile;
-
-    /**
      * The definition of the defaultBundleList artifact.
      *
      * @parameter
@@ -95,20 +88,6 @@ public abstract class AbstractBundleList
     protected ArtifactDefinition defaultBundleList;
 
     /**
-     * The Maven project.
-     *
-     * @parameter expression="${project}"
-     * @required
-     * @readonly
-     */
-    protected MavenProject project;
-
-    /**
-     * @component
-     */
-    protected MavenProjectHelper projectHelper;
-
-    /**
      * Any additional bundles to include in the project's bundles directory.
      *
      * @parameter
@@ -301,6 +280,7 @@ public abstract class AbstractBundleList
         initArtifactDefinitions(dependencies);
     }
 
+    @SuppressWarnings("unchecked")
     private final void initBundleList() throws IOException, XmlPullParserException, MojoExecutionException
{
         initArtifactDefinitions();
         if (isCurrentArtifact(defaultBundleList)) {
@@ -329,6 +309,18 @@ public abstract class AbstractBundleList
                 bundleList.remove(def.toBundle(), false);
             }
         }
+        
+        Set<Artifact> dependencies = project.getDependencyArtifacts();
+        for (Artifact artifact : dependencies) {
+            if (PARTIAL.equals(artifact.getType())) {
+                getLog().info(
+                        String.format("merging partial bundle list for %s:%s:%s", artifact.getGroupId(),
+                                artifact.getArtifactId(), artifact.getVersion()));
+                bundleList.merge(readBundleList(artifact.getFile()));
+            }
+        }
+        
+        
         initBundleList(bundleList);
 
         rewriteBundleList(bundleList);

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
Fri Jun 17 16:41:07 2011
@@ -31,7 +31,7 @@ import org.apache.sling.maven.projectsup
  * @phase package
  * @description attach the bundle list as a project artifact
  */
-public class AttachBundleListMojo extends AbstractBundleListMojo {
+public class AttachBundleListMojo extends AbstractUsingBundleListMojo {
 
     private static final String CLASSIFIER = "bundlelist";
 

Copied: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
(from r1136139, sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java)
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java?p2=sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java&p1=sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java&r1=1136139&r2=1136928&rev=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/AttachPartialBundleListMojo.java
Fri Jun 17 16:41:07 2011
@@ -16,29 +16,20 @@
  */
 package org.apache.sling.maven.projectsupport;
 
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer;
 
 /**
- * Output the bundle list back to the console.
- * 
- * @goal output-bundle-list
+ * Attaches the bundle list as a project artifact.
  * 
+ * @goal attach-partial-bundle-list
+ * @phase package
+ * @description attach the partial bundle list as a project artifact
  */
-public class OutputBundleListMojo extends AbstractBundleListMojo {
+public class AttachPartialBundleListMojo extends AbstractBundleListMojo {
 
-    @Override
-    protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException
{
-        BundleListXpp3Writer writer = new BundleListXpp3Writer();
-        try {
-            writer.write(new OutputStreamWriter(System.out), getBundleList());
-        } catch (IOException e) {
-            throw new MojoExecutionException("Unable to write bundle list", e);
-        }
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        project.getArtifact().setFile(bundleListFile);
     }
 
 }

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
Fri Jun 17 16:41:07 2011
@@ -32,7 +32,7 @@ import org.apache.sling.maven.projectsup
  * @goal check-bundle-list-for-snapshots
  *
  */
-public class CheckBundleListForSnapshotsMojo extends AbstractBundleListMojo {
+public class CheckBundleListForSnapshotsMojo extends AbstractUsingBundleListMojo {
 
     /**
      * True if the build should be failed if a snapshot is found.

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
Fri Jun 17 16:41:07 2011
@@ -37,7 +37,7 @@ import org.jdom.output.XMLOutputter;
  * @phase package
  * @description create a karaf feature descriptor
  */
-public class CreateKarafFeatureDescriptorMojo extends AbstractBundleListMojo {
+public class CreateKarafFeatureDescriptorMojo extends AbstractUsingBundleListMojo {
 
     private static final String CLASSIFIER = "features";
 

Modified: sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java?rev=1136928&r1=1136927&r2=1136928&view=diff
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
(original)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
Fri Jun 17 16:41:07 2011
@@ -29,7 +29,7 @@ import org.apache.sling.maven.projectsup
  * @goal output-bundle-list
  * 
  */
-public class OutputBundleListMojo extends AbstractBundleListMojo {
+public class OutputBundleListMojo extends AbstractUsingBundleListMojo {
 
     @Override
     protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException
{

Added: sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1136928&view=auto
==============================================================================
--- sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/components.xml
(added)
+++ sling/trunk/maven/maven-launchpad-plugin/src/main/resources/META-INF/plexus/components.xml
Fri Jun 17 16:41:07 2011
@@ -0,0 +1,53 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role-hint>partialbundlelist</role-hint>
+      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <!-- START SNIPPET: bundle-lifecycle -->
+            <phases>
+              <package>org.apache.sling:maven-launchpad-plugin:attach-partial-bundle-list</package>
+              <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+              <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+            </phases>
+            <!-- END SNIPPET: bundle-lifecycle -->
+          </lifecycle>
+        </lifecycles>
+      </configuration>
+    </component>
+    <component>
+      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
+      <role-hint>partialbundlelist</role-hint>
+      <implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
+      <configuration>
+        <type>partialbundlelist</type>
+        <includesDependencies>false</includesDependencies>
+        <language>xml</language>
+        <extension>xml</extension>
+        <addedToClasspath>false</addedToClasspath>
+      </configuration>
+    </component>
+  </components>
+</component-set>



Mime
View raw message