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 96dc6d5bf9f1d86121c459351f16e9f16942615a
Author: Justin Edelson <[email protected]>
AuthorDate: Wed Dec 30 15:58:45 2009 +0000

    Introducing the maven-launchpad-plugin and builder (fka uber) project 
described in SLING-1197
    
    git-svn-id: 
https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@894656
 13f79535-47bb-0310-9956-ffa450edef68
---
 LICENSE                                            | 202 +++++++++++
 NOTICE                                             |   9 +
 README.txt                                         |  27 ++
 pom.xml                                            | 131 ++++++++
 .../projectsupport/AbstractBundleListMojo.java     | 369 +++++++++++++++++++++
 .../maven/projectsupport/ArtifactDefinition.java   | 176 ++++++++++
 .../maven/projectsupport/AttachBundleListMojo.java |  48 +++
 .../CheckBundleListForSnapshotsMojo.java           |  89 +++++
 .../maven/projectsupport/CreateBundleJarMojo.java  | 200 +++++++++++
 .../CreateKarafFeatureDescriptorMojo.java          | 164 +++++++++
 .../maven/projectsupport/PreparePackageMojo.java   | 213 ++++++++++++
 src/main/mdo/bundle-list.xml                       | 110 ++++++
 src/main/resources/META-INF/LICENSE                | 202 +++++++++++
 src/main/resources/META-INF/NOTICE                 |  26 ++
 .../maven/projectsupport/dependencies.properties   |  20 ++
 .../projectsupport/PreparePackageMojoTest.java     | 108 ++++++
 16 files changed, 2094 insertions(+)

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/NOTICE b/NOTICE
new file mode 100644
index 0000000..64f7009
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,9 @@
+Apache Sling Launchpad Maven Plugin
+Copyright 2008-2009 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..ddcf41e
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,27 @@
+Apache Sling Maven Plugin
+
+Maven Plugin supporting the Sling Launchpad framework.
+
+Getting Started
+===============
+
+This component uses a Maven 2 (http://maven.apache.org/) build
+environment. It requires a Java 5 JDK (or higher) and Maven 
(http://maven.apache.org/)
+2.0.7 or later. We recommend to use the latest Maven version.
+
+If you have Maven 2 installed, you can compile and
+package the jar using the following command:
+
+    mvn package
+
+See the Maven 2 documentation for other build features.
+
+The latest source code for this component is available in the
+Subversion (http://subversion.tigris.org/) source repository of
+the Apache Software Foundation. If you have Subversion installed,
+you can checkout the latest source using the following command:
+
+    svn checkout 
http://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin
+
+See the Subversion documentation for other source control features.
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..212bf9e
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+    <!--
+        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.
+    -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>8</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <groupId>org.apache.sling</groupId>
+    <artifactId>maven-launchpad-plugin</artifactId>
+    <version>2.0.5-SNAPSHOT</version>
+    <packaging>maven-plugin</packaging>
+
+    <name>Apache Sling Launchpad Maven Plugin</name>
+    <description>
+        Maven Plugin supporting Sling Launchpad
+    </description>
+
+    <scm>
+        
<connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</connection>
+        
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin</developerConnection>
+        
<url>http://svn.apache.org/viewvc/sling/trunk/maven/maven-launchpad-plugin</url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.modello</groupId>
+                <artifactId>modello-maven-plugin</artifactId>
+                <version>1.1</version>
+                <executions>
+                    <execution>
+                        <id>bundle-manifest.xml</id>
+                        <goals>
+                            <goal>java</goal>
+                            <goal>xpp3-reader</goal>
+                            <goal>xpp3-writer</goal>
+                        </goals>
+                        <configuration>
+                            <version>1.0.0</version>
+                            <models>
+                                <model>src/main/mdo/bundle-list.xml
+                                </model>
+                            </models>
+                        </configuration>
+                    </execution>
+                </executions>
+                <configuration>
+                    <packageWithVersion>true</packageWithVersion>
+                    <useJava5>true</useJava5>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+                <version>2.5.1</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <configuration>
+                    <!-- No javadocs -->
+                    <excludePackageNames>
+                        org.apache.sling
+                    </excludePackageNames>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+            <version>2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-archiver</artifactId>
+            <version>2.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-archiver</artifactId>
+            <version>1.0-alpha-9</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.codehaus.plexus</groupId>
+                    <artifactId>plexus-container-default</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.codehaus.plexus</groupId>
+                    <artifactId>plexus-component-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+               <groupId>org.codehaus.plexus</groupId>
+               <artifactId>plexus-utils</artifactId>
+               <version>1.5.15</version>
+        </dependency>
+        <dependency>
+               <groupId>org.jdom</groupId>
+               <artifactId>jdom</artifactId>
+               <version>1.1</version>
+        </dependency>
+    </dependencies>
+</project>
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
 
b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
new file mode 100644
index 0000000..22ac54e
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -0,0 +1,369 @@
+/*
+ * 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.
+ */
+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.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.InvalidVersionSpecificationException;
+import org.apache.maven.artifact.versioning.VersionRange;
+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.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import 
org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Reader;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import 
org.codehaus.plexus.components.io.fileselectors.IncludeExcludeFileSelector;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+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;
+
+    /**
+     * @parameter default-value="${basedir}/src/main/bundles/list.xml"
+     */
+    protected File bundleListFile;
+
+    /**
+     * To look up Archiver/UnArchiver implementations
+     * 
+     * @component
+     */
+    private ArchiverManager archiverManager;
+
+    /**
+     * @component
+     */
+    protected MavenProjectHelper projectHelper;
+
+    /**
+     * The Maven project.
+     * 
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+    /**
+     * Used to look up Artifacts in the remote repository.
+     * 
+     * @component
+     */
+    private ArtifactFactory factory;
+
+    /**
+     * Location of the local repository.
+     * 
+     * @parameter expression="${localRepository}"
+     * @readonly
+     * @required
+     */
+    private ArtifactRepository local;
+
+    /**
+     * JAR Packaging type.
+     */
+    protected static final String JAR = "jar";
+
+    /**
+     * WAR Packaging type.
+     */
+    protected static final String WAR = "war";
+
+    /**
+     * 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;
+
+    public final void execute() throws MojoFailureException,
+            MojoExecutionException {
+        try {
+            initArtifactDefinitions();
+        } catch (IOException e) {
+            throw new MojoExecutionException(
+                    "Unable to load dependency information from properties 
file.",
+                    e);
+        }
+        executeWithArtifacts();
+
+    }
+
+    protected abstract void executeWithArtifacts()
+            throws MojoExecutionException, MojoFailureException;
+
+    protected Artifact getArtifact(ArtifactDefinition bundle)
+            throws MojoExecutionException {
+        return getArtifact(bundle.getGroupId(), bundle.getArtifactId(), bundle
+                .getVersion(), bundle.getType() != null ? bundle.getType()
+                : JAR, bundle.getClassifier());
+    }
+
+    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);
+        }
+        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 final void initArtifactDefinitions() throws IOException {
+        Properties dependencies = new Properties();
+        dependencies
+                .load(getClass()
+                        .getResourceAsStream(
+                                
"/org/apache/sling/maven/projectsupport/dependencies.properties"));
+
+        if (defaultBundles == null) {
+            defaultBundles = new ArtifactDefinition();
+        }
+        
defaultBundles.initDefaults(dependencies.getProperty("defaultBundles"));
+
+        if (defaultBundleList == null) {
+            defaultBundleList = new ArtifactDefinition();
+        }
+        
defaultBundleList.initDefaults(dependencies.getProperty("defaultBundleList"));
+
+        initArtifactDefinitions(dependencies);
+    }
+
+    protected void initArtifactDefinitions(Properties dependencies) {
+    }
+
+    protected void copy(ArtifactDefinition additionalBundle,
+            File outputDirectory) throws MojoExecutionException {
+        Artifact artifact = getArtifact(additionalBundle);
+        copy(artifact.getFile(), additionalBundle.getStartLevel(),
+                outputDirectory);
+    }
+
+    protected void copy(File file, int startLevel, File outputDirectory)
+            throws MojoExecutionException {
+        File destination = new File(outputDirectory, String.format(
+                "%s/%s/%s/%s", baseDestination, bundlesDirectory, startLevel,
+                file.getName()));
+        if (shouldCopy(file, destination)) {
+            getLog().info(
+                    String.format("Copying bundle from %s to %s", file
+                            .getPath(), destination.getPath()));
+            try {
+                FileUtils.copyFile(file, destination);
+            } catch (IOException e) {
+                throw new MojoExecutionException("Unable to copy bundle from "
+                        + file.getPath(), e);
+            }
+        }
+    }
+
+
+    protected BundleList readBundleList() throws IOException, 
XmlPullParserException {
+        return readBundleList(bundleListFile);
+    }
+
+    
+    protected void outputBundleList(File outputDirectory)
+            throws MojoExecutionException {
+        try {
+            if (bundleListFile != null && bundleListFile.exists()) {
+                getLog().info(
+                        "Using bundle list file from "
+                                + bundleListFile.getAbsolutePath());
+                BundleList bundles = readBundleList(bundleListFile);
+                copyBundles(bundles, outputDirectory);
+                return;
+            }
+        } catch (Exception e) {
+            getLog()
+                    .warn(
+                            String
+                                    .format(
+                                            "Unable to use bundle list from 
%s. Falling back to bundles artifact.",
+                                            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);
+        }
+
+        Artifact defaultBundlesArtifact = getArtifact(defaultBundles
+                .getGroupId(), defaultBundles.getArtifactId(), defaultBundles
+                .getVersion(), defaultBundles.getType(), defaultBundles
+                .getClassifier());
+        unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
+                "META-INF/**");
+    }
+
+    private void copyBundles(BundleList bundles, File outputDirectory)
+            throws MojoExecutionException {
+        for (StartLevel startLevel : bundles.getStartLevels()) {
+            for (Bundle bundle : startLevel.getBundles()) {
+                copy(new ArtifactDefinition(bundle, startLevel.getLevel()),
+                        outputDirectory);
+            }
+        }
+    }
+
+    protected BundleList readBundleList(File file) throws IOException,
+            XmlPullParserException {
+        BundleListXpp3Reader reader = new BundleListXpp3Reader();
+        FileInputStream fis = new FileInputStream(file);
+        try {
+            return reader.read(fis);
+        } finally {
+            fis.close();
+        }
+    }
+
+    protected boolean shouldCopy(File source, File dest) {
+        if (!dest.exists()) {
+            return true;
+        } else {
+            return source.lastModified() > dest.lastModified();
+        }
+    }
+
+    protected void unpack(File source, File destination, String includes,
+            String excludes) throws MojoExecutionException {
+        getLog().info(
+                "Unpacking " + source.getPath() + " to\n  "
+                        + destination.getPath());
+        try {
+            destination.mkdirs();
+
+            UnArchiver unArchiver = archiverManager.getUnArchiver(source);
+
+            unArchiver.setSourceFile(source);
+            unArchiver.setDestDirectory(destination);
+
+            if (StringUtils.isNotEmpty(excludes)
+                    || StringUtils.isNotEmpty(includes)) {
+                IncludeExcludeFileSelector[] selectors = new 
IncludeExcludeFileSelector[] { new IncludeExcludeFileSelector() };
+
+                if (StringUtils.isNotEmpty(excludes)) {
+                    selectors[0].setExcludes(excludes.split(","));
+                }
+
+                if (StringUtils.isNotEmpty(includes)) {
+                    selectors[0].setIncludes(includes.split(","));
+                }
+
+                unArchiver.setFileSelectors(selectors);
+            }
+
+            unArchiver.extract();
+        } catch (NoSuchArchiverException e) {
+            throw new MojoExecutionException("Unable to find archiver for "
+                    + source.getPath(), e);
+        } catch (ArchiverException e) {
+            throw new MojoExecutionException("Unable to unpack "
+                    + source.getPath(), e);
+        }
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java 
b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
new file mode 100644
index 0000000..1c89034
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * The definition of an artifact.
+ */
+public class ArtifactDefinition {
+
+    /** The artifactId */
+    private String artifactId;
+
+    /** The classifier */
+    private String classifier;
+
+    /** The groupId */
+    private String groupId;
+
+    /** The start level at which this artifact should be started */
+    private int startLevel;
+
+    /** The artifact type */
+    private String type;
+
+    /** The artifact version */
+    private String version;
+    
+    public ArtifactDefinition() {
+    }
+
+    public ArtifactDefinition(Bundle bundle, int startLevel) {
+               this.groupId = bundle.getGroupId();
+               this.artifactId = bundle.getArtifactId();
+               this.type = bundle.getType();
+               this.version = bundle.getVersion();
+               this.classifier = bundle.getClassifier();
+               this.startLevel = startLevel;
+       }
+
+       public String getArtifactId() {
+        return artifactId;
+    }
+
+    public String getClassifier() {
+        return classifier;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public int getStartLevel() {
+        return startLevel;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setArtifactId(String artifactId) {
+        this.artifactId = artifactId;
+    }
+
+    public void setClassifier(String classifier) {
+        this.classifier = classifier;
+    }
+
+    public void setGroupId(String groupId) {
+        this.groupId = groupId;
+    }
+
+    public void setStartLevel(int startLevel) {
+        this.startLevel = startLevel;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    @Override
+    public String toString() {
+        return "AdditionalBundle [artifactId=" + artifactId + ", classifier="
+                + classifier + ", groupId=" + groupId + ", startLevel="
+                + startLevel + ", type=" + type + ", version=" + version + "]";
+    }
+
+    /**
+     * Initialize this ArtifactDefinition with a set of default values from a
+     * comma-delimited string. This string must have 6 items in it:
+     * [groupId],[artifactId],[version],[type],[classifier],[startLevel]
+     * 
+     * The only required parameter is the last one, which must be parseable as
+     * an integer.
+     * 
+     * @param commaDelimitedList
+     *            the comma-delimited list
+     */
+    public void initDefaults(String commaDelimitedList) {
+        String[] values = commaDelimitedList.split(",");
+        if (values.length != 6) {
+            throw new IllegalArgumentException(
+                    String
+                            .format(
+                                    "The string %s does not have the correct 
number of items (6).",
+                                    commaDelimitedList));
+        }
+        initDefaults(values[0], values[1], values[2], values[3], values[4],
+                Integer.valueOf(values[5]));
+    }
+
+    /**
+     * Initialize this ArtifactDefinition with a set of default values. If the
+     * corresponding field in this object is null (or 0 in the case of start
+     * level) and the parameter is non-null, the parameter value will be used.
+     * 
+     * @param groupId
+     *            the groupId
+     * @param artifactId
+     *            the artifactId
+     * @param version
+     *            the version
+     * @param type
+     *            the artifact type
+     * @param classifier
+     *            the artifact classified
+     * @param startLevel
+     *            the start level
+     */
+    public void initDefaults(String groupId, String artifactId, String version,
+            String type, String classifier, int startLevel) {
+        if (this.groupId == null && StringUtils.isNotEmpty(groupId)) {
+            this.groupId = groupId;
+        }
+        if (this.artifactId == null && StringUtils.isNotEmpty(artifactId)) {
+            this.artifactId = artifactId;
+        }
+        if (this.version == null && StringUtils.isNotEmpty(version)) {
+            this.version = version;
+        }
+        if (this.type == null && StringUtils.isNotEmpty(groupId)) {
+            this.type = type;
+        }
+        if (this.classifier == null && StringUtils.isNotEmpty(classifier)) {
+            this.classifier = classifier;
+        }
+        if (this.startLevel == 0) {
+            this.startLevel = startLevel;
+        }
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java 
b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
new file mode 100644
index 0000000..13ede61
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Attaches the bundle list as a project artifact.
+ * 
+ * @goal attach-bundle-list
+ * @phase package
+ * @description attach the bundle list as a project artifact
+ */
+public class AttachBundleListMojo extends AbstractBundleListMojo {
+    
+    private static final String CLASSIFIER = "bundlelist";
+    
+    private static final String TYPE = "xml";
+
+    @Override
+    protected void executeWithArtifacts() throws MojoExecutionException,
+            MojoFailureException {
+        if (bundleListFile != null && bundleListFile.exists()) {
+            projectHelper.attachArtifact(project, TYPE, CLASSIFIER,
+                    bundleListFile);
+        } else {
+            throw new MojoExecutionException(
+                    "The bundle list file does not exist.");
+        }
+
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
 
b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
new file mode 100644
index 0000000..2982b93
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Validate that the bundle list file (if it exists) does not contain 
references
+ * to SNAPSHOT versions.
+ * 
+ * @goal check-bundle-list-for-snapshots
+ * 
+ */
+public class CheckBundleListForSnapshotsMojo extends AbstractBundleListMojo {
+
+    /**
+     * True if the build should be failed if a snapshot is found.
+     * 
+     * @parameter default-value="true"
+     */
+    private boolean failOnSnapshot;
+
+    @Override
+    protected void executeWithArtifacts() throws MojoExecutionException,
+            MojoFailureException {
+        if (bundleListFile.exists()) {
+            try {
+                List<Bundle> snapshots = new ArrayList<Bundle>();
+                BundleList bundleList = readBundleList();
+                for (StartLevel level : bundleList.getStartLevels()) {
+                    for (Bundle bundle : level.getBundles()) {
+                        if (isSnapshot(bundle)) {
+                            snapshots.add(bundle);
+                        }
+                    }
+                }
+                if (!snapshots.isEmpty()) {
+                    getLog()
+                            .error(
+                                    "The following entries in the bundle list 
file are SNAPSHOTs:");
+                    for (Bundle bundle : snapshots) {
+                        getLog().error(String.format("     %s:%s:%s", 
bundle.getGroupId(),
+                                bundle.getArtifactId(), bundle.getVersion()));
+                    }
+                    if (failOnSnapshot) {
+                        throw new MojoFailureException("SNAPSHOTs were found 
in the bundle list. See log.");
+                    }
+                }
+            } catch (IOException e) {
+                throw new MojoExecutionException(
+                        "Unable to load bundle list file", e);
+            } catch (XmlPullParserException e) {
+                throw new MojoExecutionException(
+                        "Unable to load bundle list file", e);
+            }
+
+        } else {
+            getLog().debug("Bundle list file does not exist. Skipping.");
+        }
+    }
+
+    private boolean isSnapshot(Bundle bundle) {
+        return bundle.getVersion().endsWith("SNAPSHOT");
+    }
+
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java 
b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
new file mode 100644
index 0000000..97b7747
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
@@ -0,0 +1,200 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Create and attach a JAR file containing the resolved artifacts from the
+ * bundle list.
+ *
+ * @goal create-bundle-jar
+ * @requiresDependencyResolution test
+ * @phase package
+ *
+ */
+public class CreateBundleJarMojo extends AbstractBundleListMojo {
+
+       /**
+        * The list of resources we want to add to the bundle JAR file.
+        *
+        * @parameter
+        */
+       private Resource[] resources;
+
+       /**
+        * The output directory.
+        *
+        * @parameter default-value="${project.build.directory}"
+        */
+       private File outputDirectory;
+
+       /**
+        * Name of the generated JAR.
+        *
+        * @parameter default-value="${project.artifactId}-${project.version}"
+        * @required
+        */
+       private String jarName;
+
+       /**
+        * The Jar archiver.
+        *
+        * @component role="org.codehaus.plexus.archiver.Archiver" 
roleHint="jar"
+        */
+       private JarArchiver jarArchiver;
+
+       private static final String CLASSIFIER = "bundles";
+
+       public static final String[] DEFAULT_INCLUDES = { "**/**" };
+
+       private void addBundles() throws MojoExecutionException {
+               BundleList bundles = null;
+               try {
+                       bundles = readBundleList(bundleListFile);
+               } catch (IOException e) {
+                       throw new MojoExecutionException("Unable to read bundle 
list file",
+                                       e);
+               } catch (XmlPullParserException e) {
+                       throw new MojoExecutionException("Unable to read bundle 
list file",
+                                       e);
+               }
+
+               for (StartLevel level : bundles.getStartLevels()) {
+                       for (Bundle bundle : level.getBundles()) {
+                               Artifact artifact = getArtifact(new 
ArtifactDefinition(bundle,
+                                               level.getLevel()));
+                               String destFileName = baseDestination + "/" + 
bundlesDirectory
+                                               + "/" + level.getLevel() + "/"
+                                               + artifact.getFile().getName();
+                               try {
+                                       jarArchiver.addFile(artifact.getFile(), 
destFileName);
+                               } catch (ArchiverException e) {
+                                       throw new MojoExecutionException(
+                                                       "Unable to add file to 
bundle jar file: "
+                                                                       + 
artifact.getFile().getAbsolutePath(), e);
+                               }
+                       }
+               }
+       }
+
+       private void addResources(Resource resource) throws 
MojoExecutionException {
+               getLog().info(
+                               String.format("Adding resources [%s] to [%s]", 
resource
+                                               .getDirectory(), 
resource.getTargetPath()));
+               String[] fileNames = getFilesToCopy(resource);
+               for (int i = 0; i < fileNames.length; i++) {
+                       String targetFileName = fileNames[i];
+                       if (resource.getTargetPath() != null) {
+                               targetFileName = resource.getTargetPath() + 
File.separator
+                                               + targetFileName;
+                       }
+
+                       try {
+                               jarArchiver.addFile(new 
File(resource.getDirectory(),
+                                               fileNames[i]), targetFileName);
+                       } catch (ArchiverException e) {
+                               throw new MojoExecutionException(
+                                               "Unable to add resources to JAR 
file", e);
+                       }
+
+               }
+       }
+
+       private File createJARFile() throws MojoExecutionException {
+               File jarFile = new File(outputDirectory, jarName + "-" + 
CLASSIFIER
+                               + "." + JAR);
+               jarArchiver.setDestFile(jarFile);
+
+               addBundles();
+               addResources();
+
+               try {
+                       jarArchiver.createArchive();
+               } catch (ArchiverException e) {
+                       throw new MojoExecutionException(
+                                       "Unable to create bundle jar file", e);
+               } catch (IOException e) {
+                       throw new MojoExecutionException(
+                                       "Unable to create bundle jar file", e);
+               }
+
+               return jarFile;
+       }
+
+       private void addResources() throws MojoExecutionException {
+               if (resources != null) {
+                       for (Resource resource : resources) {
+                               if (!(new 
File(resource.getDirectory())).isAbsolute()) {
+                                       
resource.setDirectory(project.getBasedir() + File.separator
+                                                       + 
resource.getDirectory());
+                               }
+                               addResources(resource);
+                       }
+               }
+       }
+
+       @Override
+       protected void executeWithArtifacts() throws MojoExecutionException,
+                       MojoFailureException {
+               File jarFile = createJARFile();
+               projectHelper.attachArtifact(project, JAR, CLASSIFIER, jarFile);
+       }
+
+       /**
+        * Returns a list of filenames that should be copied over to the 
destination
+        * directory.
+        *
+        * @param resource
+        *            the resource to be scanned
+        * @return the array of filenames, relative to the sourceDir
+        */
+       @SuppressWarnings("unchecked")
+    private static String[] getFilesToCopy(Resource resource) {
+               DirectoryScanner scanner = new DirectoryScanner();
+               scanner.setBasedir(resource.getDirectory());
+               if (resource.getIncludes() != null && 
!resource.getIncludes().isEmpty()) {
+                       scanner.setIncludes((String[]) 
resource.getIncludes().toArray(
+                                       new 
String[resource.getIncludes().size()]));
+               } else {
+                       scanner.setIncludes(DEFAULT_INCLUDES);
+               }
+               if (resource.getExcludes() != null && 
!resource.getExcludes().isEmpty()) {
+                       scanner.setExcludes((String[]) 
resource.getExcludes().toArray(
+                                       new 
String[resource.getExcludes().size()]));
+               }
+
+               scanner.addDefaultExcludes();
+
+               scanner.scan();
+
+               return scanner.getIncludedFiles();
+       }
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
 
b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
new file mode 100644
index 0000000..f34382e
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
@@ -0,0 +1,164 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.output.Format;
+import org.jdom.output.XMLOutputter;
+
+/**
+ * Create and attach a karaf feature descriptor XML file.
+ * 
+ * @goal create-karaf-descriptor
+ * @phase package
+ * @description create a karaf feature descriptor
+ */
+public class CreateKarafFeatureDescriptorMojo extends AbstractBundleListMojo {
+
+       private static final String CLASSIFIER = "features";
+
+       private static final String TYPE = "xml";
+
+       /**
+        * @parameter
+        */
+       private String[] additionalBundles;
+
+       private Set<String> excludedArtifacts;
+       
+       /**
+        * @parameter
+        */
+       private String[] exclusions;
+       
+       /**
+        * @parameter default-value="sling"
+        */
+       private String featureName;
+       
+       /**
+        * @parameter default-value="sling-2.0"
+        */
+       private String featuresName;
+
+       /**
+        * @parameter default-value="${project.version}"
+        */
+       private String featureVersion;
+
+       /**
+        * The output directory.
+        * 
+        * @parameter default-value="${project.build.directory}"
+        */
+       private File outputDirectory;
+
+       @Override
+       protected void executeWithArtifacts() throws MojoExecutionException,
+                       MojoFailureException {
+               Document doc = new Document();
+
+               Element features = new Element("features");
+               doc.setRootElement(features);
+               features.setAttribute("name", featuresName);
+
+               Element feature = new Element("feature");
+               features.addContent(feature);
+               feature.setAttribute("name", featureName);
+               feature.setAttribute("version", featureVersion);
+               
+               excludedArtifacts = new HashSet<String>();
+               if (exclusions != null) {
+                       excludedArtifacts.addAll(Arrays.asList(exclusions));
+               }
+
+               try {
+                       BundleList bundleList = readBundleList();
+                       for (StartLevel level : bundleList.getStartLevels()) {
+                               for (Bundle bundle : level.getBundles()) {
+                                       if (include(bundle)) {
+                                               String bundleRef = 
String.format("mvn:%s/%s/%s", bundle
+                                                               .getGroupId(), 
bundle.getArtifactId(), bundle
+                                                               .getVersion());
+                                               feature.addContent(new 
Element("bundle")
+                                                               
.setText(bundleRef));
+                                       }
+                               }
+                       }
+               } catch (IOException e) {
+                       throw new MojoExecutionException("Unable to read bundle 
list file",
+                                       e);
+               } catch (XmlPullParserException e) {
+                       throw new MojoExecutionException("Unable to read bundle 
list file",
+                                       e);
+               }
+
+               if (additionalBundles != null) {
+                       for (String bundleRef : additionalBundles) {
+                               Element bundle = new Element("bundle");
+                               bundle.setText(bundleRef);
+                               feature.addContent(bundle);
+                       }
+               }
+
+               File outputFile = new File(outputDirectory, "features.xml");
+
+               FileOutputStream out = null;
+               try {
+                       out = new FileOutputStream(outputFile);
+                       new 
XMLOutputter(Format.getPrettyFormat().setEncoding("UTF-8"))
+                                       .output(doc, out);
+               } catch (IOException e) {
+                       throw new MojoExecutionException("Unable to write 
features.xml", e);
+               } finally {
+                       if (out != null) {
+                               try {
+                                       out.close();
+                               } catch (IOException e) {
+                               }
+                       }
+               }
+               projectHelper.attachArtifact(project, TYPE, CLASSIFIER, 
outputFile);
+
+       }
+
+       /**
+        * Decide if the bundle should be included in the bundle list.
+        * 
+        * @param bundle the bundle
+        * @return true if it should be included
+        */
+       private boolean include(Bundle bundle) {
+               String ref = bundle.getGroupId() + ":" + bundle.getArtifactId();
+               return !excludedArtifacts.contains(ref);
+       }
+
+}
diff --git 
a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java 
b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
new file mode 100644
index 0000000..7bd414d
--- /dev/null
+++ 
b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -0,0 +1,213 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Initialize a Sling application project by extracting bundles into the 
correct
+ * locations.
+ * 
+ * @goal prepare-package
+ * @requiresDependencyResolution test
+ * @phase process-sources
+ * @description initialize a Sling application project
+ */
+public class PreparePackageMojo extends AbstractBundleListMojo {
+
+       /**
+        * Any additional bundles to include in the project's bundles directory.
+        * 
+        * @parameter
+        */
+       private ArtifactDefinition[] additionalBundles;
+
+       /**
+        * If true, install the default bundles.
+        * 
+        * @parameter default-value="true"
+        */
+       private boolean installDefaultBundles;
+
+       /**
+        * The output directory for the default bundles in a WAR-packaged 
project,
+        * the base JAR (in the subdirectory named in the baseDestination
+        * parameter), and any additional bundles.
+        * 
+        * @parameter 
default-value="${project.build.directory}/launchpad-bundles"
+        */
+       private File warOutputDirectory;
+
+       /**
+        * The Maven project.
+        * 
+        * @parameter expression="${project}"
+        * @readonly
+        */
+       private MavenProject project;
+
+       /**
+        * The project's packaging type.
+        * 
+        * @parameter expression="${project.packaging}"
+        */
+       private String packaging;
+
+       /**
+        * The definition of the base JAR.
+        * 
+        * @parameter
+        */
+       private ArtifactDefinition base;
+
+       /**
+        * The definition of the package to be included to provide web support 
for
+        * JAR-packaged projects (i.e. pax-web).
+        * 
+        * @parameter
+        */
+       private ArtifactDefinition jarWebSupport;
+
+       /**
+        * The project's build output directory (i.e. target/classes).
+        * 
+        * @parameter expression="${project.build.outputDirectory}"
+        * @readonly
+        */
+       private File buildOutputDirectory;
+
+       public void executeWithArtifacts() throws MojoExecutionException, 
MojoFailureException {
+               copyBaseArtifact();
+               if (installDefaultBundles) {
+                       unpackDefaultBundles();
+               }
+               copyAdditionalBundles();
+               copyWebSupportBundle();
+               if (JAR.equals(packaging)) {
+                       unpackBaseArtifact();
+               }
+       }
+
+       private void copyAdditionalBundles() throws MojoExecutionException {
+               if (additionalBundles != null) {
+                       for (int i = 0; i < additionalBundles.length; i++) {
+                               copy(additionalBundles[i], 
getOutputDirectory());
+                       }
+               }
+       }
+
+       private void copyBaseArtifact() throws MojoExecutionException {
+               Artifact artifact = getBaseArtifact();
+               if (artifact == null) {
+                       throw new MojoExecutionException(
+                                       String
+                                                       .format(
+                                                                       
"Project doesn't have a base dependency of groupId %s and artifactId %s",
+                                                                       
base.getGroupId(), base.getArtifactId()));
+               }
+               File destinationDir = new File(getOutputDirectory(), 
baseDestination);
+               File destinationFile = new File(destinationDir, artifact
+                               .getArtifactId()
+                               + "." + 
artifact.getArtifactHandler().getExtension());
+               if (shouldCopy(artifact.getFile(), destinationFile)) {
+                       try {
+                               getLog().info(
+                                               String.format("Copying base 
artifact from %s to %s.",
+                                                               
artifact.getFile(), destinationFile));
+                               FileUtils.copyFile(artifact.getFile(), 
destinationFile);
+                       } catch (IOException e) {
+                               throw new MojoExecutionException(
+                                               "Unable to copy base 
artifact.", e);
+                       }
+               } else {
+                       getLog().debug(
+                                       String.format("Skipping copy of base 
artifact from %s.",
+                                                       artifact.getFile()));
+               }
+       }
+
+       private void copyWebSupportBundle() throws MojoExecutionException {
+               if (JAR.equals(packaging)) {
+                       copy(jarWebSupport, getOutputDirectory());
+               }
+
+       }
+
+       private Artifact getBaseArtifact() throws MojoExecutionException {
+               Artifact baseDependency = getBaseDependency();
+               if (baseDependency == null) {
+                       return null;
+               }
+
+               return getArtifact(base.getGroupId(), base.getArtifactId(),
+                               baseDependency.getVersion(), base.getType(), 
base
+                                               .getClassifier());
+
+       }
+
+       private Artifact getBaseDependency() {
+               return (Artifact) project.getArtifactMap().get(
+                               base.getGroupId() + ":" + base.getArtifactId());
+       }
+
+       private File getOutputDirectory() {
+               if (WAR.equals(packaging)) {
+                       return warOutputDirectory;
+               } else {
+                       return buildOutputDirectory;
+               }
+       }
+       
+
+
+       protected void initArtifactDefinitions(Properties dependencies) {
+               if (base == null) {
+                       base = new ArtifactDefinition();
+               }
+               base.initDefaults(dependencies.getProperty("base"));
+
+               if (jarWebSupport == null) {
+                       jarWebSupport = new ArtifactDefinition();
+               }
+               
jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
+       }
+       
+       private void unpackBaseArtifact() throws MojoExecutionException {
+               Artifact artifact = getBaseDependency();
+               if (artifact == null) {
+                       throw new MojoExecutionException(
+                                       String
+                                                       .format(
+                                                                       
"Project doesn't have a base dependency of groupId %s and artifactId %s",
+                                                                       
base.getGroupId(), base.getArtifactId()));
+               }
+               unpack(artifact.getFile(), buildOutputDirectory, null, null);
+       }
+
+       private void unpackDefaultBundles() throws MojoExecutionException {
+               outputBundleList(getOutputDirectory());
+
+       }
+}
diff --git a/src/main/mdo/bundle-list.xml b/src/main/mdo/bundle-list.xml
new file mode 100644
index 0000000..db071ab
--- /dev/null
+++ b/src/main/mdo/bundle-list.xml
@@ -0,0 +1,110 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+ xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 
http://modello.codehaus.org/xsd/modello-1.0.0.xsd";>
+    <id>bundle-list</id>
+    <name>BundleList</name>
+    <description>
+        <![CDATA[Model of a bundle list.]]>
+    </description>
+    <defaults>
+        <default>
+            <key>package</key>
+            <value>org.apache.sling.maven.projectsupport.bundlelist</value>
+        </default>
+    </defaults>
+    <classes>
+        <class rootElement="true" xml.tagName="bundles">
+            <name>BundleList</name>
+            <description>List of bundles.</description>
+            <version>1.0.0</version>
+            <fields>
+                <field>
+                    <name>startLevels</name>
+                    <version>1.0.0</version>
+                    <association xml.itemsStyle="flat">
+                        <type>StartLevel</type>
+                        <multiplicity>*</multiplicity>
+                    </association>
+                </field>
+            </fields>
+        </class>
+        <class xml.tagName="startLevel">
+               <name>StartLevel</name>
+            <version>1.0.0</version>
+            <fields>
+               <field xml.attribute="true">
+                       <name>level</name>
+                       <version>1.0.0</version>
+                       <type>int</type>
+               </field>
+                <field>
+                    <name>bundles</name>
+                    <version>1.0.0</version>
+                    <association xml.itemsStyle="flat">
+                        <type>Bundle</type>
+                        <multiplicity>*</multiplicity>
+                    </association>
+                </field>
+            </fields>
+        </class>
+        <class xml.tagName="bundle">
+            <name>Bundle</name>
+            <description>A bundle.</description>
+            <fields>
+                <field>
+                    <name>groupId</name>
+                    <version>1.0.0</version>
+                    <type>String</type>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>artifactId</name>
+                    <version>1.0.0</version>
+                    <type>String</type>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>version</name>
+                    <version>1.0.0</version>
+                    <type>String</type>
+                    <required>true</required>
+                </field>
+                <field>
+                    <name>type</name>
+                    <version>1.0.0</version>
+                    <type>String</type>
+                    <defaultValue>jar</defaultValue>
+                </field>
+                <field>
+                    <name>classifier</name>
+                    <version>1.0.0</version>
+                    <type>String</type>
+                </field>
+                <field>
+                    <name>startLevel</name>
+                    <version>1.0.0</version>
+                    <type>int</type>
+                    <required>true</required>
+                </field>
+            </fields>
+        </class>
+    </classes>
+</model>
diff --git a/src/main/resources/META-INF/LICENSE 
b/src/main/resources/META-INF/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/main/resources/META-INF/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
diff --git a/src/main/resources/META-INF/NOTICE 
b/src/main/resources/META-INF/NOTICE
new file mode 100644
index 0000000..6fd562c
--- /dev/null
+++ b/src/main/resources/META-INF/NOTICE
@@ -0,0 +1,26 @@
+Apache Sling Launchpad Maven Plugin
+Copyright 2008-2009 The Apache Software Foundation
+
+Apache Sling is based on source code originally developed 
+by Day Software (http://www.day.com/).
+
+
+I. Included Software
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+Licensed under the Apache License 2.0.
+
+
+II. Used Software
+
+This product uses software developed at
+The OSGi Alliance (http://www.osgi.org/).
+Copyright 2006 The OSGi Alliance.
+Licensed under the Apache License 2.0.
+
+
+III. License Summary
+- Apache License 2.0
+
+
diff --git 
a/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
 
b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
new file mode 100644
index 0000000..de4410c
--- /dev/null
+++ 
b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
@@ -0,0 +1,20 @@
+#  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.
+base=org.apache.sling,org.apache.sling.launchpad.base,,jar,,0
+defaultBundles=org.apache.sling,org.apache.sling.launchpad.builder,RELEASE,jar,bundles,0
+defaultBundleList=org.apache.sling,org.apache.sling.launchpad.builder,RELEASE,xml,bundlelist,0
+jarWebSupport=org.ops4j.pax.web,pax-web-service,RELEASE,jar,,5
diff --git 
a/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
 
b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
new file mode 100644
index 0000000..172260d
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+package org.apache.sling.maven.projectsupport;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ * Tests of PreparePageMojo
+ */
+public class PreparePackageMojoTest {
+
+       @Test
+       public void testInitArtifactDefinitionsAllDefaults() throws Exception {
+               PreparePackageMojo mojo = new PreparePackageMojo();
+               invokeInitArtifactDefinitions(mojo);
+
+               makeArtifactAssertions(mojo, "base", "org.apache.sling",
+                               "org.apache.sling.launchpad.base", null, "jar", 
null, 0);
+
+               makeArtifactAssertions(mojo, "defaultBundles", 
"org.apache.sling",
+                               "org.apache.sling.launchpad.builder", 
"RELEASE", "jar", "bundles", 0);
+
+        makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling",
+                "org.apache.sling.launchpad.builder", "RELEASE", "xml", 
"bundlelist", 0);
+
+               makeArtifactAssertions(mojo, "jarWebSupport", 
"org.ops4j.pax.web",
+                               "pax-web-service", "RELEASE", "jar", null, 5);
+
+       }
+
+       private void makeArtifactAssertions(PreparePackageMojo mojo, String 
name,
+                       String groupId, String artifactId, String version, 
String type,
+                       String classifier, int startLevel) throws Exception {
+               ArtifactDefinition def = getArtifactDefinition(mojo, name);
+
+               assertNotNull(def);
+               assertEquals(groupId, def.getGroupId());
+               assertEquals(artifactId, def.getArtifactId());
+               assertEquals(version, def.getVersion());
+               assertEquals(type, def.getType());
+               assertEquals(classifier, def.getClassifier());
+               assertEquals(startLevel, def.getStartLevel());
+       }
+
+       private void invokeInitArtifactDefinitions(PreparePackageMojo mojo)
+                       throws Exception {
+               Method method = findMethod(mojo.getClass(), 
"initArtifactDefinitions");
+               method.setAccessible(true);
+               method.invoke(mojo);
+               method.setAccessible(false);
+       }
+
+       private Method findMethod(Class<?> clazz, String name, Class<?>... args)
+                       throws NoSuchMethodException {
+               while (clazz != Object.class) {
+                       try {
+                               return clazz.getDeclaredMethod(name, args);
+                       } catch (SecurityException e) {
+                       } catch (NoSuchMethodException e) {
+                       }
+                       clazz = clazz.getSuperclass();
+               }
+
+               throw new NoSuchMethodException("Could not find method " + 
name);
+       }
+
+       private Field findField(Class<?> clazz, String name)
+                       throws NoSuchFieldException {
+               while (clazz != Object.class) {
+                       try {
+                               return clazz.getDeclaredField(name);
+                       } catch (SecurityException e) {
+                       } catch (NoSuchFieldException e) {
+                       }
+                       clazz = clazz.getSuperclass();
+               }
+
+               throw new NoSuchFieldException("Could not find field " + name);
+       }
+
+       private ArtifactDefinition getArtifactDefinition(PreparePackageMojo 
mojo,
+                       String name) throws Exception {
+               Field field = findField(mojo.getClass(), name);
+               field.setAccessible(true);
+               ArtifactDefinition def = (ArtifactDefinition) field.get(mojo);
+               field.setAccessible(false);
+               return def;
+       }
+
+}

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

Reply via email to