You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:14:43 UTC
[sling-maven-launchpad-plugin] annotated tag
maven-launchpad-plugin-2.0.10 created (now 3fd936d)
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a change to annotated tag maven-launchpad-plugin-2.0.10
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git.
at 3fd936d (tag)
tagging 1b78d49c69d57e9aeb81b29aa71cc016c8582b0d (commit)
by Justin Edelson
on Tue Feb 15 02:04:47 2011 +0000
- Log -----------------------------------------------------------------
maven-launchpad-plugin-2.0.10
-----------------------------------------------------------------------
This annotated tag includes the following new commits:
new 96dc6d5 Introducing the maven-launchpad-plugin and builder (fka uber) project described in SLING-1197
new ff6a77c SLING-1310 - Changing artifactId of launchpad.builder to launchpad
new 1f5bd24 SLING-1322 - adding check to avoid loading launchpad artifact if it's the same as the current project's
new 347e5fb SLING-1322 - removing extraneous project variable
new b8899de SLING-1323 - adding "bundlesToRemove" option
new 5682b2d Unifying bundle addition / removal code (re: SLING-1321)
new bb29c9b SLING-1351 Fixed, added the Start levels in when there are none defined.
new 8ffdfb1 SLING-1364 - creating prepare-test-webapp mojo
new d2e7962 SLING-1351 When the xpp parser loads a Bundle it only sets the attributes specified on the bundle, and takes no account of any containers, hence on merge the container start level must be inspected to determine where a bundle should be merged. If not specified (ie 0) it should be merged in the containing bundle. This means that its not going to be possible to specify a bundle as loading in start level 0 by setting the level on the bundle. To load in start level 0 you mus [...]
new 8c0ec78 SLING-1441 - adding run goal to launchpad plugin
new b3f5ef2 SLING-1454 - adding ability to read filtered sling properties from a file
new df85fd6 SLING-1442 - adding start and stop goals to launchpad plugin
new 74b72b9 exposing controlHost configuration parameter in launchpad plugin
new 99ee468 fix formatting of pom file
new 9768cfb SLING-1442 - shouldn't be killing the JVM on a "stop" command.
new dd65aa8 SLING-1491 - switching from pax web to felix httpservice
new eb5e840 updating to released launchpad base
new 2183492 reformatting pom
new cc7a04f [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.6
new d69b5db [maven-release-plugin] prepare for next development iteration
new 2e9d194 using next snapshot until release vote is finished
new e75b100 Update some notice files
new 2551177 Use released version of launchpad base
new 917e990 Use released parent pom.
new c6c90d7 SLING-1586 - adding overwrite version on merge code
new 99e00dc SLING-1591 - upgrading to latest base artifacts
new c52ad9c SLING-1692 - replacing dummy code for updated() method.
new 2945145 SLING-1693 - adding xml as a resource provider provided extension
new 42035b5 changing classname and adding missing license header
new 119f700 SLING-1693 - implemeting a search path for resources
new b508767 SLING-1743 / SLING-845 - setting slingHome to default to ${basedir}/sling. No longer need the antrun execution as a result
new ea8d50e SLING-1799 - adding output-bundle-list mojo
new d05a0b4 tabs -> spaces
new f300177 SLING-1795 - adding Drools-based rules for rewriting bundle list. Includes sample rule which can be activated by running "mvn -P test-reactor-sling-bundles clean install" from the root project.
new cbb45d4 updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
new 25154c3 adding jboss repository (for drools dependencies)
new 793fe22 trivial improvement in error handling
new 85a3ca6 SLING-1803 - adding emma report. runs with -P emma
new 3106d97 SLING-1843 - adding launchpad:display-bundle-updates goal
new c31bbfa Update to recent snapshots
new bad22bd prepping maven-launchpad-plugin for release
new 63eaf6e [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.8
new 9fd2bdb [maven-release-plugin] prepare for next development iteration
new 61f3f68 SLING-1597 - adding config installation via launchpad
new c0518da removing LICENSE and NOTICE files for future releases
new ede6563 SLING-1980 - fixing by adding some code as described by Benjamin on maven-users
new f33d169 updating pom pre-release
new 64e03a1 [maven-release-plugin] prepare release maven-launchpad-plugin-2.0.10
new 1b78d49 [maven-scm] copy for tag maven-launchpad-plugin-2.0.10
The 49 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
--
To stop receiving notification emails like this one, please contact
['"commits@sling.apache.org" <co...@sling.apache.org>'].
[sling-maven-launchpad-plugin] 07/49: SLING-1351 Fixed,
added the Start levels in when there are none defined.
Posted by ro...@apache.org.
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 bb29c9bbff1f6ecd67ace7958e3112be687b1c03
Author: Ian Boston <ie...@apache.org>
AuthorDate: Thu Feb 4 15:44:57 2010 +0000
SLING-1351 Fixed, added the Start levels in when there are none defined.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@906531 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
index cd838c8..43b78fc 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
@@ -85,6 +85,7 @@ public abstract class BaseBundleList {
}
StartLevel sl = new StartLevel();
+ getStartLevels().add(sl);
sl.setLevel(startLevel);
return sl;
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 08/49: SLING-1364 - creating
prepare-test-webapp mojo
Posted by ro...@apache.org.
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 8ffdfb1a86bc6563ac4b487037f6e5e3d946e2ba
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Feb 17 03:56:20 2010 +0000
SLING-1364 - creating prepare-test-webapp mojo
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@910814 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/PreparePackageMojo.java | 4 +-
.../projectsupport/PrepareTestWebAppMojo.java | 91 ++++++++++++++++++++++
2 files changed, 93 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 5972e34..55629db 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -166,7 +166,7 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
base.getGroupId() + ":" + base.getArtifactId());
}
- private File getOutputDirectory() {
+ protected File getOutputDirectory() {
if (WAR.equals(packaging)) {
return warOutputDirectory;
} else {
@@ -174,7 +174,7 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
}
}
- private void unpackBaseArtifact() throws MojoExecutionException {
+ protected void unpackBaseArtifact() throws MojoExecutionException {
Artifact artifact = getBaseDependency();
if (artifact == null) {
throw new MojoExecutionException(
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java
new file mode 100644
index 0000000..229c894
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PrepareTestWebAppMojo.java
@@ -0,0 +1,91 @@
+/*
+ * 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 org.apache.maven.artifact.handler.ArtifactHandler;
+import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Initialize a Sling integration test webapp by extracting bundles into the
+ * correct locations, including the current artifact.
+ *
+ * @goal prepare-test-webapp
+ * @requiresDependencyResolution test
+ * @phase package
+ */
+public class PrepareTestWebAppMojo extends PreparePackageMojo {
+
+ /**
+ * The project's build directory (i.e. target).
+ *
+ * @parameter expression="${project.build.directory}"
+ * @readonly
+ */
+ private File buildDirectory;
+
+ /**
+ * The start level for the current artifact.
+ *
+ * @parameter default-value="16"
+ */
+ private int startLevel;
+
+ /**
+ * The output directory for bundles.
+ *
+ * @parameter default-value="${project.build.directory}/launchpad-bundles"
+ */
+ private File outputDirectory;
+
+ /**
+ * @component
+ */
+ private ArtifactHandlerManager artifactHandlerManager;
+
+ public void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ super.executeWithArtifacts();
+ copy(getPrimaryArtifact(), startLevel, getOutputDirectory());
+ }
+
+ @Override
+ protected File getOutputDirectory() {
+ return outputDirectory;
+ }
+
+
+ @Override
+ protected void unpackBaseArtifact() throws MojoExecutionException {
+ // No-op. This is JAR-specific.
+ }
+
+ private File getPrimaryArtifact() throws MojoExecutionException {
+ ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(project.getPackaging());
+
+ String artifactName = project.getBuild().getFinalName() + "." + handler.getExtension();
+
+ File file = new File(buildDirectory, artifactName);
+ if (!file.exists()) {
+ throw new MojoExecutionException("Project's primary artifact (" + file.getPath() + ") doesn't exist.");
+ }
+ return file;
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 10/49: SLING-1441 - adding run goal
to launchpad plugin
Posted by ro...@apache.org.
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 8c0ec781839a6127fcd5caebabaae5416c09047e
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Mar 15 18:18:52 2010 +0000
SLING-1441 - adding run goal to launchpad plugin
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@923372 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 16 ++
.../apache/sling/maven/projectsupport/RunMojo.java | 267 +++++++++++++++++++++
2 files changed, 283 insertions(+)
diff --git a/pom.xml b/pom.xml
index 212bf9e..db71dd5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -127,5 +127,21 @@
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.base</artifactId>
+ <version>2.1.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.base</artifactId>
+ <version>2.1.1-SNAPSHOT</version>
+ <classifier>app</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
new file mode 100644
index 0000000..4d52086
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -0,0 +1,267 @@
+/*
+ * 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 static org.apache.felix.framework.util.FelixConstants.*;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.felix.framework.Logger;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.launchpad.base.impl.ResourceProvider;
+import org.apache.sling.launchpad.base.impl.Sling;
+import org.apache.sling.launchpad.base.shared.Notifiable;
+import org.apache.sling.launchpad.base.shared.SharedConstants;
+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.osgi.framework.BundleException;
+
+/**
+ * Run a Launchpad application.
+ *
+ * @goal run
+ * @requiresDependencyResolution test
+ *
+ */
+public class RunMojo extends AbstractBundleListMojo implements Notifiable {
+
+ /** Default log level setting if no set on command line (value is "INFO"). */
+ private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;
+
+ /** Mapping between log level numbers and names */
+ private static final String[] logLevels = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG" };
+
+ /**
+ * The configuration property setting the port on which the HTTP service
+ * listens
+ */
+ private static final String PROP_PORT = "org.osgi.service.http.port";
+ /** Return the log level code for the string */
+ private static int toLogLevelInt(String level, int defaultLevel) {
+ for (int i = 0; i < logLevels.length; i++) {
+ if (logLevels[i].equalsIgnoreCase(level)) {
+ return i;
+ }
+ }
+
+ return defaultLevel;
+ }
+
+ /**
+ * @parameter expression="${http.port}" default-value="8080"
+ */
+ private int httpPort;
+
+ /**
+ * The definition of the package to be included to provide web support for
+ * JAR-packaged projects (i.e. pax-web).
+ *
+ * @parameter
+ */
+ private ArtifactDefinition jarWebSupport;
+
+ /**
+ * @parameter expression="${felix.log.level}"
+ */
+ private String logLevel;
+
+ private ResourceProvider resourceProvider = new ResourceProvider() {
+
+ @Override
+ public Iterator<String> getChildren(String path) {
+ if (path.equals("resources/bundles")) {
+ List<String> levels = new ArrayList<String>();
+ for (StartLevel level : getBundleList().getStartLevels()) {
+ levels.add(String.valueOf(level.getLevel()) + "/");
+ }
+ return levels.iterator();
+ } else if (path.equals("resources/corebundles")) {
+ List<String> empty = Collections.emptyList();
+ return empty.iterator();
+ } else {
+ try {
+ int i = Integer.parseInt(path);
+ List<String> bundles = new ArrayList<String>();
+ for (StartLevel level : getBundleList().getStartLevels()) {
+ if (level.getLevel() == i) {
+ for (Bundle bundle : level.getBundles()) {
+ ArtifactDefinition d = new ArtifactDefinition(bundle, i);
+ try {
+ Artifact artifact = getArtifact(d);
+ bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
+ } catch (Exception e) {
+ getLog().error("Unable to resolve artifact ", e);
+ }
+ }
+
+ break;
+ }
+ }
+ return bundles.iterator();
+
+ } catch (NumberFormatException e) {
+ getLog().warn("un-handlable path " + path);
+ return null;
+
+ }
+ }
+ }
+
+ @Override
+ public URL getResource(String path) {
+ if (path.endsWith(".properties")) {
+ return getClass().getResource("/" + path);
+ } else {
+ try {
+ return new URL(path);
+ } catch (MalformedURLException e) {
+ getLog().error("Expecting a real URL", e);
+ return null;
+ }
+ }
+ }
+ };
+
+ private Thread shutdown = new Thread() {
+ /**
+ * Called when the Java VM is being terminiated, for example because the
+ * KILL signal has been sent to the process. This method calls stop on
+ * the launched Sling instance to terminate the framework before
+ * returning.
+ */
+ @Override
+ public void run() {
+ getLog().info("Java VM is shutting down", null);
+ shutdown();
+ }
+
+ // ---------- Shutdown support for control listener and shutdown hook
+
+ void shutdown() {
+ // remove the shutdown hook, will fail if called from the
+ // shutdown hook itself. Otherwise this prevents shutdown
+ // from being called again
+ try {
+ Runtime.getRuntime().removeShutdownHook(this);
+ } catch (Throwable t) {
+ // don't care for problems removing the hook
+ }
+
+ // now really shutdown sling
+ if (sling != null) {
+ getLog().info("Stopping Sling", null);
+ sling.destroy();
+ }
+ }
+ };
+
+ private Sling sling;
+
+ /**
+ * @parameter expression="${sling.home}" default-value="sling"
+ */
+ private String slingHome;
+
+ /**
+ * @parameter default-value="true"
+ */
+ private boolean forceBundleLoad;
+
+ public void stopped() {
+ sling = null;
+ }
+
+ public void updated(File tmpFile) {
+ // TODO - should anything happen here?
+ getLog().info("File updated " + tmpFile.getAbsolutePath());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ Runtime.getRuntime().addShutdownHook(shutdown);
+
+ try {
+ final Map<String, String> props = new HashMap<String, String>();
+
+ props.put(SharedConstants.SLING_HOME, slingHome);
+
+ if (forceBundleLoad) {
+ props.put(SharedConstants.FORCE_PACKAGE_BUNDLE_LOADING, "true");
+ }
+
+ // set up and configure Felix Logger
+ int logLevelNum;
+ if (logLevel == null) {
+ logLevelNum = DEFAULT_LOG_LEVEL;
+ } else {
+ logLevelNum = toLogLevelInt(logLevel, DEFAULT_LOG_LEVEL);
+ }
+ props.put(LOG_LEVEL_PROP, String.valueOf(logLevelNum));
+ // Display port number on console, in case HttpService doesn't
+ getLog().info("HTTP server port: " + httpPort);
+ props.put(PROP_PORT, String.valueOf(httpPort));
+
+ // prevent tons of needless WARN from the framework
+ Logger logger = new Logger();
+ logger.setLogLevel(Logger.LOG_ERROR);
+
+ // creating the instance launches the framework and we are done here
+ sling = new Sling(this, logger, resourceProvider, props);
+
+ // TODO this seems hacky!
+ while (sling != null) {
+ Thread.sleep(100);
+ }
+
+ } catch (BundleException be) {
+ getLog().error("Failed to Start OSGi framework", be);
+ } catch (InterruptedException e) {
+ }
+
+ }
+
+ protected void initArtifactDefinitions(Properties dependencies) {
+ if (jarWebSupport == null) {
+ jarWebSupport = new ArtifactDefinition();
+ }
+ jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
+ }
+
+ /**
+ * Add the JAR Web Support bundle to the bundle list.
+ */
+ @Override
+ protected void initBundleList(BundleList bundleList) {
+ bundleList.add(jarWebSupport.toBundle());
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 18/49: reformatting pom
Posted by ro...@apache.org.
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 21834925b6d4786d8aa855d326850001110c196b
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Apr 21 15:40:25 2010 +0000
reformatting pom
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936358 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index abda034..526aafe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,8 +11,7 @@
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">
+<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>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 02/49: SLING-1310 - Changing
artifactId of launchpad.builder to launchpad
Posted by ro...@apache.org.
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 ff6a77cee642857af50c7beeb6de76898db42f3e
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Jan 25 15:40:05 2010 +0000
SLING-1310 - Changing artifactId of launchpad.builder to launchpad
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@902843 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/maven/projectsupport/dependencies.properties | 4 ++--
.../org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
index de4410c..c6803c1 100644
--- a/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
+++ b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
@@ -15,6 +15,6 @@
# 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
+defaultBundles=org.apache.sling,org.apache.sling.launchpad,RELEASE,jar,bundles,0
+defaultBundleList=org.apache.sling,org.apache.sling.launchpad,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
index 172260d..c46f338 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
@@ -36,10 +36,10 @@ public class PreparePackageMojoTest {
"org.apache.sling.launchpad.base", null, "jar", null, 0);
makeArtifactAssertions(mojo, "defaultBundles", "org.apache.sling",
- "org.apache.sling.launchpad.builder", "RELEASE", "jar", "bundles", 0);
+ "org.apache.sling.launchpad", "RELEASE", "jar", "bundles", 0);
makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling",
- "org.apache.sling.launchpad.builder", "RELEASE", "xml", "bundlelist", 0);
+ "org.apache.sling.launchpad", "RELEASE", "xml", "bundlelist", 0);
makeArtifactAssertions(mojo, "jarWebSupport", "org.ops4j.pax.web",
"pax-web-service", "RELEASE", "jar", null, 5);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 46/49: SLING-1980 - fixing by adding
some code as described by Benjamin on maven-users
Posted by ro...@apache.org.
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 ede6563df09085d3e4a8c1ddd79880aaf9b3afd0
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Feb 14 13:56:46 2011 +0000
SLING-1980 - fixing by adding some code as described by Benjamin on maven-users
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1070487 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/AbstractBundleListMojo.java | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 7201bd3..cd6bb11 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -24,10 +24,13 @@ import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.artifact.resolver.ArtifactResolver;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.execution.MavenSession;
@@ -129,6 +132,13 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
private ArtifactFactory factory;
/**
+ * Used to look up Artifacts in the remote repository.
+ *
+ * @component hint="maven"
+ */
+ private ArtifactMetadataSource metadataSource;
+
+ /**
* If true, include the default bundles.
*
* @parameter default-value="true"
@@ -225,6 +235,19 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
artifact = factory.createDependencyArtifact(groupId, artifactId, vr, type, classifier,
Artifact.SCOPE_COMPILE);
}
+
+ // This code kicks in when the version specifier is a range.
+ if (vr.getRecommendedVersion() == null) {
+ try {
+ List availVersions = metadataSource.retrieveAvailableVersions(artifact, local, remoteRepos);
+ ArtifactVersion resolvedVersion = vr.matchVersion(availVersions);
+ artifact.setVersion(resolvedVersion.toString());
+ } catch (ArtifactMetadataRetrievalException e) {
+ throw new MojoExecutionException("Unable to find version for artifact", e);
+ }
+
+ }
+
try {
resolver.resolve(artifact, remoteRepos, local);
} catch (ArtifactResolutionException e) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 40/49: Update to recent snapshots
Posted by ro...@apache.org.
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 c31bbfa87b21cf03f4df6f06312a175fb19232e8
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Dec 8 16:37:27 2010 +0000
Update to recent snapshots
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1043504 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 52faf92..fbce260 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>10-SNAPSHOT</version>
+ <version>11-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 32/49: SLING-1799 - adding
output-bundle-list mojo
Posted by ro...@apache.org.
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 ea8d50e410c5c91f86bc7d8d125d8c5c9dbb64da
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Thu Sep 23 15:58:08 2010 +0000
SLING-1799 - adding output-bundle-list mojo
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1000510 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/OutputBundleListMojo.java | 44 ++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
new file mode 100644
index 0000000..031949f
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/OutputBundleListMojo.java
@@ -0,0 +1,44 @@
+/*
+ * 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.io.OutputStreamWriter;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer;
+
+/**
+ * Output the bundle list back to the console.
+ *
+ * @goal output-bundle-list
+ *
+ */
+public class OutputBundleListMojo extends AbstractBundleListMojo {
+
+ @Override
+ protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ BundleListXpp3Writer writer = new BundleListXpp3Writer();
+ try {
+ writer.write(new OutputStreamWriter(System.out), getBundleList());
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to write bundle list", e);
+ }
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 33/49: tabs -> spaces
Posted by ro...@apache.org.
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 d05a0b4dabc608c658199a2675cf2f45bccda8c8
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Oct 13 19:52:24 2010 +0000
tabs -> spaces
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1022266 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/pom.xml b/pom.xml
index 0570d92..aedcce8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,14 +117,14 @@
</exclusions>
</dependency>
<dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>1.5.15</version>
+ <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>
+ <groupId>org.jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
@@ -138,14 +138,14 @@
<classifier>app</classifier>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>4.2.0</version>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>4.2.0</version>
</dependency>
<dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-filtering</artifactId>
- <version>1.0-beta-4</version>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.0-beta-4</version>
</dependency>
</dependencies>
</project>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 04/49: SLING-1322 - removing
extraneous project variable
Posted by ro...@apache.org.
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 347e5fb8ba9e09f798d0ef072fbd663d728bdbe6
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Jan 25 21:53:05 2010 +0000
SLING-1322 - removing extraneous project variable
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@902989 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/PreparePackageMojo.java | 28 ++++++++--------------
1 file changed, 10 insertions(+), 18 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 7bd414d..3449740 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -29,7 +29,7 @@ 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
@@ -39,14 +39,14 @@ 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;
@@ -55,29 +55,21 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
* 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;
@@ -85,14 +77,14 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
/**
* 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
*/
@@ -179,7 +171,7 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
return buildOutputDirectory;
}
}
-
+
protected void initArtifactDefinitions(Properties dependencies) {
@@ -193,7 +185,7 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
}
jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
}
-
+
private void unpackBaseArtifact() throws MojoExecutionException {
Artifact artifact = getBaseDependency();
if (artifact == null) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 34/49: SLING-1795 - adding
Drools-based rules for rewriting bundle list. Includes sample rule which
can be activated by running "mvn -P test-reactor-sling-bundles clean
install" from the root project.
Posted by ro...@apache.org.
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 f300177d6413c9f242e4b33583db9d10a193971c
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Oct 13 19:52:37 2010 +0000
SLING-1795 - adding Drools-based rules for rewriting bundle list. Includes sample rule which can be activated by running "mvn -P test-reactor-sling-bundles clean install" from the root project.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1022267 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 ++
.../projectsupport/AbstractBundleListMojo.java | 63 +++++++++++++++++++++-
.../AbstractLaunchpadStartingMojo.java | 7 ---
.../sling/maven/projectsupport/drools-globals.drl | 24 +++++++++
4 files changed, 90 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index aedcce8..8f226ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,5 +147,10 @@
<artifactId>maven-filtering</artifactId>
<version>1.0-beta-4</version>
</dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
+ <version>5.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
index a0c3897..cd66edc 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -30,6 +30,7 @@ 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.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -39,6 +40,14 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Reader;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderError;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.io.ResourceFactory;
+import org.drools.runtime.StatefulKnowledgeSession;
public abstract class AbstractBundleListMojo extends AbstractMojo {
@@ -141,6 +150,18 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
*/
private ArtifactResolver resolver;
+ /**
+ * @parameter
+ */
+ private File[] rewriteRuleFiles;
+
+ /**
+ * @parameter expression="${session}
+ * @required
+ * @readonly
+ */
+ protected MavenSession mavenSession;
+
public final void execute() throws MojoFailureException, MojoExecutionException {
try {
initBundleList();
@@ -252,8 +273,9 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
} else {
bundleList = new BundleList();
if (includeDefaultBundles) {
- Artifact defBndListArtifact = getArtifact(defaultBundleList.getGroupId(), defaultBundleList.getArtifactId(),
- defaultBundleList.getVersion(), defaultBundleList.getType(), defaultBundleList.getClassifier());
+ Artifact defBndListArtifact = getArtifact(defaultBundleList.getGroupId(),
+ defaultBundleList.getArtifactId(), defaultBundleList.getVersion(), defaultBundleList.getType(),
+ defaultBundleList.getClassifier());
getLog().info("Using bundle list file from " + defBndListArtifact.getFile().getAbsolutePath());
bundleList = readBundleList(defBndListArtifact.getFile());
}
@@ -273,6 +295,43 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
}
}
initBundleList(bundleList);
+
+ rewriteBundleList(bundleList);
+ }
+
+ private void rewriteBundleList(BundleList bundleList) throws MojoExecutionException {
+ if (rewriteRuleFiles != null) {
+ KnowledgeBase knowledgeBase = createKnowledgeBase(rewriteRuleFiles);
+ StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();
+ try {
+ session.setGlobal("mavenSession", mavenSession);
+ session.setGlobal("mavenProject", project);
+ session.insert(bundleList);
+ session.fireAllRules();
+ } finally {
+ session.dispose();
+ }
+ }
+ }
+
+ private KnowledgeBase createKnowledgeBase(File[] files) throws MojoExecutionException {
+ KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ builder.add(ResourceFactory.newClassPathResource("drools-globals.drl", getClass()), ResourceType.DRL);
+ for (File file : files) {
+ getLog().info("Parsing rule file " + file.getAbsolutePath());
+ builder.add(ResourceFactory.newFileResource(file), ResourceType.DRL);
+ }
+ if (builder.hasErrors()) {
+ getLog().error("Rule errors:");
+ for (KnowledgeBuilderError error : builder.getErrors()) {
+ getLog().error(error.toString());
+ }
+ throw new MojoExecutionException("Unable to create rules. See log for details.");
+ }
+
+ KnowledgeBase base = KnowledgeBaseFactory.newKnowledgeBase();
+ base.addKnowledgePackages(builder.getKnowledgePackages());
+ return base;
}
private BundleList readBundleList(File file) throws IOException, XmlPullParserException {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index bf44e40..29004a6 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -110,13 +110,6 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
*/
private MavenFileFilter mavenFileFilter;
- /**
- * @parameter expression="${session}"
- * @required
- * @readonly
- */
- private MavenSession mavenSession;
-
private ResourceProvider resourceProvider = new ResourceProvider() {
@Override
diff --git a/src/main/resources/org/apache/sling/maven/projectsupport/drools-globals.drl b/src/main/resources/org/apache/sling/maven/projectsupport/drools-globals.drl
new file mode 100644
index 0000000..58a5d6c
--- /dev/null
+++ b/src/main/resources/org/apache/sling/maven/projectsupport/drools-globals.drl
@@ -0,0 +1,24 @@
+# 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.
+
+# this file ensures that the globals are always defined, even if they're not needed
+
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+
+global MavenSession mavenSession
+global MavenProject mavenProject
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 11/49: SLING-1454 - adding ability
to read filtered sling properties from a file
Posted by ro...@apache.org.
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 b3f5ef24afbe782e19cb865985b2147c23ccf468
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Sat Mar 20 02:22:33 2010 +0000
SLING-1454 - adding ability to read filtered sling properties from a file
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@925532 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +++
.../apache/sling/maven/projectsupport/RunMojo.java | 46 ++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/pom.xml b/pom.xml
index db71dd5..2b88de5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -143,5 +143,10 @@
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.shared</groupId>
+ <artifactId>maven-filtering</artifactId>
+ <version>1.0-beta-4</version>
+ </dependency>
</dependencies>
</project>
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
index 4d52086..061ecd8 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -19,10 +19,12 @@ package org.apache.sling.maven.projectsupport;
import static org.apache.felix.framework.util.FelixConstants.*;
import java.io.File;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -31,8 +33,12 @@ import java.util.Properties;
import org.apache.felix.framework.Logger;
import org.apache.maven.artifact.Artifact;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.shared.filtering.MavenFileFilter;
+import org.apache.maven.shared.filtering.MavenFilteringException;
+import org.apache.maven.shared.filtering.PropertyUtils;
import org.apache.sling.launchpad.base.impl.ResourceProvider;
import org.apache.sling.launchpad.base.impl.Sling;
import org.apache.sling.launchpad.base.shared.Notifiable;
@@ -62,6 +68,7 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
* listens
*/
private static final String PROP_PORT = "org.osgi.service.http.port";
+
/** Return the log level code for the string */
private static int toLogLevelInt(String level, int defaultLevel) {
for (int i = 0; i < logLevels.length; i++) {
@@ -91,6 +98,24 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
*/
private String logLevel;
+ /**
+ * @parameter expression="${propertiesFile}"
+ * default-value="src/test/config/sling.properties"
+ */
+ private File propertiesFile;
+
+ /**
+ * @component
+ */
+ private MavenFileFilter mavenFileFilter;
+
+ /**
+ * @parameter expression="${session}"
+ * @required
+ * @readonly
+ */
+ private MavenSession mavenSession;
+
private ResourceProvider resourceProvider = new ResourceProvider() {
@Override
@@ -234,6 +259,27 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
Logger logger = new Logger();
logger.setLogLevel(Logger.LOG_ERROR);
+ if (propertiesFile.exists()) {
+ File tmp = null;
+ try {
+ tmp = File.createTempFile("sling", "props");
+ mavenFileFilter.copyFile(propertiesFile, tmp, true, project, null, true, System
+ .getProperty("file.encoding"), mavenSession);
+ Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
+ for (Object key : loadedProps.keySet()) {
+ props.put((String) key, (String) loadedProps.get(key));
+ }
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to create filtered properties file", e);
+ } catch (MavenFilteringException e) {
+ throw new MojoExecutionException("Unable to create filtered properties file", e);
+ } finally {
+ if (tmp != null) {
+ tmp.delete();
+ }
+ }
+ }
+
// creating the instance launches the framework and we are done here
sling = new Sling(this, logger, resourceProvider, props);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 41/49: prepping
maven-launchpad-plugin for release
Posted by ro...@apache.org.
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 bad22bd21c8441cef53a92e5036c62ed60adddc5
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Sat Dec 11 23:16:21 2010 +0000
prepping maven-launchpad-plugin for release
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1044739 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index fbce260..23846e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>11-SNAPSHOT</version>
+ <version>9</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
@@ -138,12 +138,12 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.2.0</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 30/49: SLING-1693 - implemeting a
search path for resources
Posted by ro...@apache.org.
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 119f7007634e7f96480ebf794d30e07651318257
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Aug 24 18:07:45 2010 +0000
SLING-1693 - implemeting a search path for resources
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@988642 13f79535-47bb-0310-9956-ffa450edef68
---
.../AbstractLaunchpadStartingMojo.java | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 1bd8cb1..1413714 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -100,6 +100,12 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
private File propertiesFile;
/**
+ * @parameter expression="${resourceProviderRoot}"
+ * default-value="src/test/resources"
+ */
+ private File resourceProviderRoot;
+
+ /**
* @component
*/
private MavenFileFilter mavenFileFilter;
@@ -155,13 +161,23 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
@Override
public URL getResource(String path) {
- if (path.endsWith(".properties") || path.endsWith(".xml")) {
- return getClass().getResource("/" + path);
+ File resourceFile = new File(resourceProviderRoot, path);
+ if (resourceFile.exists()) {
+ try {
+ return resourceFile.toURI().toURL();
+ } catch (MalformedURLException e) {
+ getLog().error("Unable to create URL for file", e);
+ return null;
+ }
} else {
+ URL fromClasspath = getClass().getResource("/" + path);
+ if (fromClasspath != null) {
+ return fromClasspath;
+ }
+
try {
return new URL(path);
} catch (MalformedURLException e) {
- getLog().error("Expecting a real URL", e);
return null;
}
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 37/49: trivial improvement in error
handling
Posted by ro...@apache.org.
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 793fe22ab59eabc87ba8fcc7625373c5c8604618
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Oct 15 00:17:58 2010 +0000
trivial improvement in error handling
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1022779 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index cd66edc..73b31ef 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -165,6 +165,8 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
public final void execute() throws MojoFailureException, MojoExecutionException {
try {
initBundleList();
+ } catch (MojoExecutionException e) {
+ throw e;
} catch (Exception e) {
throw new MojoExecutionException("Unable to load dependency information from properties file.", e);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 31/49: SLING-1743 / SLING-845 -
setting slingHome to default to ${basedir}/sling. No longer need the antrun
execution as a result
Posted by ro...@apache.org.
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 b508767ec725724caa0aed63f4f25e4c37d81a9a
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Thu Sep 9 18:56:48 2010 +0000
SLING-1743 / SLING-845 - setting slingHome to default to ${basedir}/sling. No longer need the antrun execution as a result
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@995541 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 1413714..bf44e40 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -187,7 +187,7 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
private Sling sling;
/**
- * @parameter expression="${sling.home}" default-value="sling"
+ * @parameter expression="${sling.home}" default-value="${basedir}/sling"
*/
private String slingHome;
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 47/49: updating pom pre-release
Posted by ro...@apache.org.
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 f33d1698002744c8c04c16ec96cdb4e82d926e62
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Feb 15 01:59:21 2011 +0000
updating pom pre-release
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1070748 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 80513cb..74572c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>9</version>
+ <version>10</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
@@ -138,17 +138,17 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.api</artifactId>
- <version>0.0.1-SNAPSHOT</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.3.0</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 24/49: Use released parent pom.
Posted by ro...@apache.org.
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 917e990a0bbdfa7d2f4cd1dc5dd6ce733e6f142e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon May 17 13:42:29 2010 +0000
Use released parent pom.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@945149 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 4dacf96..86781ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>8</version>
+ <version>9</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 26/49: SLING-1591 - upgrading to
latest base artifacts
Posted by ro...@apache.org.
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 99e00dc1bcaef2ad8fc89495ad45366371cf24f4
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Thu Jul 8 19:07:46 2010 +0000
SLING-1591 - upgrading to latest base artifacts
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@961883 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 86781ef..0570d92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,12 +129,12 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 06/49: Unifying bundle addition /
removal code (re: SLING-1321)
Posted by ro...@apache.org.
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 5682b2d1d34800af0835d1831dbe9ad301421fa8
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Feb 3 19:08:36 2010 +0000
Unifying bundle addition / removal code (re: SLING-1321)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@906180 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/AbstractBundleListMojo.java | 332 ++++++++-------------
.../AbstractLaunchpadFrameworkMojo.java | 76 +++++
.../maven/projectsupport/ArtifactDefinition.java | 21 +-
.../maven/projectsupport/AttachBundleListMojo.java | 42 ++-
.../CheckBundleListForSnapshotsMojo.java | 60 ++--
.../maven/projectsupport/CreateBundleJarMojo.java | 14 +-
.../CreateKarafFeatureDescriptorMojo.java | 188 ++++--------
.../maven/projectsupport/PreparePackageMojo.java | 140 ++++-----
.../projectsupport/bundlelist/BaseBundle.java | 33 ++
.../projectsupport/bundlelist/BaseBundleList.java | 92 ++++++
.../projectsupport/bundlelist/BaseStartLevel.java | 60 ++++
src/main/mdo/bundle-list.xml | 3 +
.../projectsupport/PreparePackageMojoTest.java | 4 +-
13 files changed, 589 insertions(+), 476 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 8aa3ae8..0c2fe4c 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -35,75 +35,72 @@ 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"
+ * JAR Packaging type.
*/
- protected String baseDestination;
+ protected static final String JAR = "jar";
/**
- * The directory which contains the start-level bundle directories.
- *
- * @parameter default-value="bundles"
+ * WAR Packaging type.
*/
- protected String bundlesDirectory;
+ protected static final String WAR = "war";
+
+ protected static boolean shouldCopy(File source, File dest) {
+ if (!dest.exists()) {
+ return true;
+ } else {
+ return source.lastModified() > dest.lastModified();
+ }
+ }
/**
- * The definition of the defaultBundleList artifact.
- *
- * @parameter
+ * @parameter default-value="${basedir}/src/main/bundles/list.xml"
*/
- private ArtifactDefinition defaultBundleList;
+ protected File bundleListFile;
/**
- * The definition of the defaultBundles package.
+ * The definition of the defaultBundleList artifact.
*
* @parameter
*/
- private ArtifactDefinition defaultBundles;
+ protected ArtifactDefinition defaultBundleList;
/**
- * @parameter default-value="${basedir}/src/main/bundles/list.xml"
+ * The Maven project.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
*/
- protected File bundleListFile;
+ protected MavenProject project;
/**
- * To look up Archiver/UnArchiver implementations
- *
* @component
*/
- private ArchiverManager archiverManager;
+ protected MavenProjectHelper projectHelper;
/**
- * @component
+ * Any additional bundles to include in the project's bundles directory.
+ *
+ * @parameter
*/
- protected MavenProjectHelper projectHelper;
+ private ArtifactDefinition[] additionalBundles;
+
+ private BundleList bundleList;
/**
- * The Maven project.
+ * Bundles which should be removed from the project's bundles directory.
*
- * @parameter expression="${project}"
- * @required
- * @readonly
+ * @parameter
*/
- protected MavenProject project;
+ private ArtifactDefinition[] bundleExclusions;
/**
* Used to look up Artifacts in the remote repository.
@@ -113,6 +110,13 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
private ArtifactFactory factory;
/**
+ * If true, include the default bundles.
+ *
+ * @parameter default-value="true"
+ */
+ private boolean includeDefaultBundles;
+
+ /**
* Location of the local repository.
*
* @parameter expression="${localRepository}"
@@ -122,16 +126,6 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
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}"
@@ -147,31 +141,41 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
*/
private ArtifactResolver resolver;
- public final void execute() throws MojoFailureException,
- MojoExecutionException {
+ public final void execute() throws MojoFailureException, MojoExecutionException {
try {
- initArtifactDefinitions();
- } catch (IOException e) {
- throw new MojoExecutionException(
- "Unable to load dependency information from properties file.",
- e);
+ initBundleList();
+ } catch (Exception e) {
+ throw new MojoExecutionException("Unable to load dependency information from properties file.", e);
}
executeWithArtifacts();
}
- protected abstract void executeWithArtifacts()
- throws MojoExecutionException, MojoFailureException;
+ /**
+ * Execute the logic of the plugin after the default artifacts have been
+ * initialized.
+ */
+ 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());
+ /**
+ * Get a resolved Artifact from the coordinates found in the artifact
+ * definition.
+ *
+ * @param def the artifact definition
+ * @return the artifact, which has been resolved
+ * @throws MojoExecutionException
+ */
+ protected Artifact getArtifact(ArtifactDefinition def) throws MojoExecutionException {
+ return getArtifact(def.getGroupId(), def.getArtifactId(), def.getVersion(), def.getType(), def.getClassifier());
}
- protected Artifact getArtifact(String groupId, String artifactId,
- String version, String type, String classifier)
+ /**
+ * Get a resolved Artifact from the coordinates provided
+ *
+ * @return the artifact, which has been resolved.
+ * @throws MojoExecutionException
+ */
+ protected Artifact getArtifact(String groupId, String artifactId, String version, String type, String classifier)
throws MojoExecutionException {
Artifact artifact;
VersionRange vr;
@@ -183,11 +187,10 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
}
if (StringUtils.isEmpty(classifier)) {
- artifact = factory.createDependencyArtifact(groupId, artifactId,
- vr, type, null, Artifact.SCOPE_COMPILE);
+ artifact = factory.createDependencyArtifact(groupId, artifactId, vr, type, null, Artifact.SCOPE_COMPILE);
} else {
- artifact = factory.createDependencyArtifact(groupId, artifactId,
- vr, type, classifier, Artifact.SCOPE_COMPILE);
+ artifact = factory.createDependencyArtifact(groupId, artifactId, vr, type, classifier,
+ Artifact.SCOPE_COMPILE);
}
try {
resolver.resolve(artifact, remoteRepos, local);
@@ -199,127 +202,80 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
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 BundleList getBundleList() {
+ return bundleList;
}
+ /**
+ * Hook methods for subclasses to initialize any additional artifact
+ * definitions.
+ *
+ * @param dependencies the dependency properties loaded from the JAR file
+ */
protected void initArtifactDefinitions(Properties dependencies) {
}
- protected void copy(ArtifactDefinition additionalBundle,
- File outputDirectory) throws MojoExecutionException {
- Artifact artifact = getArtifact(additionalBundle);
- copy(artifact.getFile(), additionalBundle.getStartLevel(),
- outputDirectory);
+ /**
+ * Hook methods for subclasses to initialize the bundle list.
+ */
+ protected void initBundleList(BundleList bundleList) {
}
- 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 boolean isCurrentArtifact(ArtifactDefinition def) {
+ return (def.getGroupId().equals(project.getGroupId()) && def.getArtifactId().equals(project.getArtifactId()));
}
+ /**
+ * Initialize the artifact definitions using defaults inside the plugin JAR.
+ *
+ * @throws IOException if the default properties can't be read
+ * @throws XmlPullParserException
+ * @throws MojoExecutionException
+ */
+ private final void initArtifactDefinitions() throws IOException {
+ Properties dependencies = new Properties();
+ dependencies.load(getClass().getResourceAsStream(
+ "/org/apache/sling/maven/projectsupport/dependencies.properties"));
- protected BundleList readBundleList() throws IOException, XmlPullParserException {
- return readBundleList(bundleListFile);
- }
+ if (defaultBundleList == null) {
+ defaultBundleList = new ArtifactDefinition();
+ }
+ defaultBundleList.initDefaults(dependencies.getProperty("defaultBundleList"));
+ initArtifactDefinitions(dependencies);
+ }
- 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;
+ private final void initBundleList() throws IOException, XmlPullParserException, MojoExecutionException {
+ initArtifactDefinitions();
+ if (isCurrentArtifact(defaultBundleList)) {
+ bundleList = readBundleList(bundleListFile);
+ } else {
+ bundleList = new BundleList();
+ if (includeDefaultBundles) {
+ Artifact artifact = getArtifact(defaultBundleList.getGroupId(), defaultBundleList.getArtifactId(),
+ defaultBundleList.getVersion(), defaultBundleList.getType(), defaultBundleList.getClassifier());
+ getLog().info("Using bundle list file from " + artifact.getFile().getAbsolutePath());
+ bundleList = readBundleList(artifact.getFile());
}
- } catch (Exception e) {
- getLog()
- .warn(
- String
- .format(
- "Unable to use bundle list from %s. Falling back to bundles artifact.",
- bundleListFile), e);
- }
- if (!isCurrentArtifact(defaultBundleList)) {
- try {
- Artifact artifact = getArtifact(defaultBundleList.getGroupId(),
- defaultBundleList.getArtifactId(), defaultBundleList
- .getVersion(), defaultBundleList.getType(),
- defaultBundleList.getClassifier());
- getLog().info(
- "Using bundle list file from "
- + artifact.getFile().getAbsolutePath());
- BundleList bundles = readBundleList(artifact.getFile());
- copyBundles(bundles, outputDirectory);
- return;
- } catch (Exception e) {
- getLog()
- .warn(
- "Unable to load bundle list from artifact. Falling back to bundle jar",
- e);
+ if (bundleListFile.exists()) {
+ bundleList.merge(readBundleList(bundleListFile));
}
}
-
- if (!isCurrentArtifact(defaultBundleList)) {
- Artifact defaultBundlesArtifact = getArtifact(defaultBundles
- .getGroupId(), defaultBundles.getArtifactId(),
- defaultBundles.getVersion(), defaultBundles.getType(),
- defaultBundles.getClassifier());
- unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
- "META-INF/**");
+ if (additionalBundles != null) {
+ for (ArtifactDefinition def : additionalBundles) {
+ bundleList.add(def.toBundle());
+ }
}
- }
-
- private boolean isCurrentArtifact(ArtifactDefinition def) {
- return (def.getGroupId().equals(project.getGroupId()) && def
- .getArtifactId().equals(project.getArtifactId()));
- }
-
- 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);
+ if (bundleExclusions != null) {
+ for (ArtifactDefinition def : bundleExclusions) {
+ bundleList.remove(def.toBundle(), false);
}
}
+ initBundleList(bundleList);
}
- protected BundleList readBundleList(File file) throws IOException,
- XmlPullParserException {
+ private BundleList readBundleList(File file) throws IOException, XmlPullParserException {
BundleListXpp3Reader reader = new BundleListXpp3Reader();
FileInputStream fis = new FileInputStream(file);
try {
@@ -329,50 +285,4 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
}
}
- 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/AbstractLaunchpadFrameworkMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
new file mode 100644
index 0000000..7eeede7
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadFrameworkMojo.java
@@ -0,0 +1,76 @@
+/*
+ * 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.plugin.MojoExecutionException;
+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.FileUtils;
+
+/**
+ * This class contains the Launchpad-framework specific utility methods.
+ *
+ */
+public abstract class AbstractLaunchpadFrameworkMojo extends AbstractBundleListMojo {
+
+ /**
+ * 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;
+
+ protected 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 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);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
index 1c89034..801b879 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ArtifactDefinition.java
@@ -41,7 +41,7 @@ public class ArtifactDefinition {
/** The artifact version */
private String version;
-
+
public ArtifactDefinition() {
}
@@ -113,10 +113,10 @@ public class ArtifactDefinition {
* 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
*/
@@ -137,7 +137,7 @@ public class ArtifactDefinition {
* 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
@@ -173,4 +173,17 @@ public class ArtifactDefinition {
}
}
+ public Bundle toBundle() {
+ Bundle bnd = new Bundle();
+ bnd.setArtifactId(artifactId);
+ bnd.setGroupId(groupId);
+ bnd.setVersion(version);
+ if (type != null) {
+ bnd.setType(type);
+ }
+ bnd.setClassifier(classifier);
+ bnd.setStartLevel(startLevel);
+ return bnd;
+ }
+
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
index 13ede61..ddb0287 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AttachBundleListMojo.java
@@ -16,33 +16,51 @@
*/
package org.apache.sling.maven.projectsupport;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.io.xpp3.BundleListXpp3Writer;
/**
* 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";
+ /**
+ * @parameter default-value="${project.build.directory}/bundleList.xml"
+ */
+ private File outputFile;
+
+ private BundleListXpp3Writer writer = new BundleListXpp3Writer();
+
@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.");
+ protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ FileWriter fw = null;
+ try {
+ fw = new FileWriter(outputFile);
+ writer.write(fw, getBundleList());
+ projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to output effective bundle list", e);
+ } finally {
+ if (fw != null) {
+ try {
+ fw.close();
+ } catch (IOException e) {
+ }
+ }
}
-
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
index 2982b93..cb0a210 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CheckBundleListForSnapshotsMojo.java
@@ -16,7 +16,6 @@
*/
package org.apache.sling.maven.projectsupport;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -25,60 +24,45 @@ 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);
- }
- }
+ protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ List<Bundle> snapshots = new ArrayList<Bundle>();
+ BundleList bundleList = getBundleList();
+ 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.");
+ }
+ 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.");
+ }
}
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
index 97b7747..01802db 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateBundleJarMojo.java
@@ -29,7 +29,6 @@ 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
@@ -40,7 +39,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
* @phase package
*
*/
-public class CreateBundleJarMojo extends AbstractBundleListMojo {
+public class CreateBundleJarMojo extends AbstractLaunchpadFrameworkMojo {
/**
* The list of resources we want to add to the bundle JAR file.
@@ -76,16 +75,7 @@ public class CreateBundleJarMojo extends AbstractBundleListMojo {
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);
- }
+ BundleList bundles = getBundleList();
for (StartLevel level : bundles.getStartLevels()) {
for (Bundle bundle : level.getBundles()) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
index f34382e..9e7e9e3 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/CreateKarafFeatureDescriptorMojo.java
@@ -19,16 +19,12 @@ 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;
@@ -36,129 +32,77 @@ 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);
- }
+ private static final String CLASSIFIER = "features";
+
+ private static final String TYPE = "xml";
+
+ /**
+ * @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}/features.xml"
+ */
+ private File outputFile;
+
+ @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);
+
+ BundleList bundleList = getBundleList();
+ for (StartLevel level : bundleList.getStartLevels()) {
+ for (Bundle bundle : level.getBundles()) {
+ String bundleRef = String.format("mvn:%s/%s/%s", bundle.getGroupId(), bundle.getArtifactId(), bundle
+ .getVersion());
+ feature.addContent(new Element("bundle").setText(bundleRef));
+ }
+ }
+
+ FileOutputStream out = null;
+ try {
+ out = new FileOutputStream(outputFile);
+ new XMLOutputter(Format.getPrettyFormat().setEncoding("UTF-8")).output(doc, out);
+ projectHelper.attachArtifact(project, TYPE, CLASSIFIER, outputFile);
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to write features.xml", e);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ }
+ }
+ }
+
+ }
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 262a6fa..5972e34 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -23,8 +23,14 @@ import java.util.Properties;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.util.DirectoryScanner;
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
+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;
/**
* Initialize a Sling application project by extracting bundles into the correct
@@ -35,28 +41,7 @@ import org.codehaus.plexus.util.FileUtils;
* @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;
-
- /**
- * Bundles which should be removed from the project's bundles directory.
- *
- * @parameter
- */
- private ArtifactDefinition[] bundlesToRemove;
-
- /**
- * If true, install the default bundles.
- *
- * @parameter default-value="true"
- */
- private boolean installDefaultBundles;
+public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
/**
* The output directory for the default bundles in a WAR-packaged project,
@@ -97,45 +82,43 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
*/
private File buildOutputDirectory;
+ /**
+ * To look up Archiver/UnArchiver implementations
+ *
+ * @component
+ */
+ private ArchiverManager archiverManager;
+
public void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
copyBaseArtifact();
- if (installDefaultBundles) {
- unpackDefaultBundles();
- }
- copyAdditionalBundles();
- copyWebSupportBundle();
- removeBundles();
+ copyBundles(getBundleList(), getOutputDirectory());
if (JAR.equals(packaging)) {
unpackBaseArtifact();
}
}
- private void removeBundles() throws MojoExecutionException {
- if (bundlesToRemove != null) {
- File bundleBaseDir = new File(getOutputDirectory(), String.format(
- "%s/%s", baseDestination, bundlesDirectory));
-
- for (ArtifactDefinition def : bundlesToRemove) {
- DirectoryScanner scanner = new DirectoryScanner();
- scanner.setBasedir(bundleBaseDir);
- scanner.setIncludes(new String[] { "**/" + def.getArtifactId() + "-*.*"});
- scanner.scan();
- for (String toRemove : scanner.getIncludedFiles()) {
- getLog().info("Deleting " + toRemove);
- new File(toRemove).delete();
- }
- }
- }
- }
+ protected void initArtifactDefinitions(Properties dependencies) {
+ if (base == null) {
+ base = new ArtifactDefinition();
+ }
+ base.initDefaults(dependencies.getProperty("base"));
- private void copyAdditionalBundles() throws MojoExecutionException {
- if (additionalBundles != null) {
- for (int i = 0; i < additionalBundles.length; i++) {
- copy(additionalBundles[i], getOutputDirectory());
- }
+ if (jarWebSupport == null) {
+ jarWebSupport = new ArtifactDefinition();
}
+ jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
}
+ /**
+ * Add the JAR Web Support bundle to the bundle list.
+ */
+ @Override
+ protected void initBundleList(BundleList bundleList) {
+ if (packaging.equals(JAR)) {
+ bundleList.add(jarWebSupport.toBundle());
+ }
+ }
+
private void copyBaseArtifact() throws MojoExecutionException {
Artifact artifact = getBaseArtifact();
if (artifact == null) {
@@ -166,13 +149,6 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
}
}
- private void copyWebSupportBundle() throws MojoExecutionException {
- if (JAR.equals(packaging)) {
- copy(jarWebSupport, getOutputDirectory());
- }
-
- }
-
private Artifact getBaseArtifact() throws MojoExecutionException {
Artifact baseDependency = getBaseDependency();
if (baseDependency == null) {
@@ -198,20 +174,6 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
}
}
-
-
- 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) {
@@ -224,8 +186,36 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
unpack(artifact.getFile(), buildOutputDirectory, null, null);
}
- private void unpackDefaultBundles() throws MojoExecutionException {
- outputBundleList(getOutputDirectory());
+ private 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/bundlelist/BaseBundle.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
new file mode 100644
index 0000000..5c9b683
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundle.java
@@ -0,0 +1,33 @@
+/*
+ * 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.bundlelist;
+
+public abstract class BaseBundle {
+
+ public abstract String getArtifactId();
+
+ public abstract String getClassifier();
+
+ public abstract String getGroupId();
+
+ public abstract int getStartLevel();
+
+ public abstract String getType();
+
+ public abstract String getVersion();
+
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
new file mode 100644
index 0000000..cd838c8
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
@@ -0,0 +1,92 @@
+/*
+ * 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.bundlelist;
+
+import java.util.List;
+
+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;
+
+public abstract class BaseBundleList {
+
+ public abstract List<StartLevel> getStartLevels();
+
+ public Bundle get(Bundle bundle, boolean compareVersions) {
+ for (StartLevel sl : getStartLevels()) {
+ Bundle foundBundle = sl.getBundle(bundle, compareVersions);
+ if (foundBundle != null) {
+ return foundBundle;
+ }
+ }
+ return null;
+ }
+
+ public boolean remove(Bundle bundle, boolean compareVersions) {
+ for (StartLevel sl : getStartLevels()) {
+ if (sl.removeBundle(bundle, compareVersions)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Merge the current bundle list with an additional list.
+ * @see add(Bundle)
+ *
+ * @param bundleList the new bundle list
+ */
+ public void merge(BundleList bundleList) {
+ for (StartLevel sl : bundleList.getStartLevels()) {
+ for (Bundle bnd : sl.getBundles()) {
+ add(bnd);
+ }
+ }
+ }
+
+ /**
+ * Add an artifact definition. If it already exists, update the version, but
+ * do not change the start level.
+ *
+ * @param newBnd the bundle to add
+ */
+ public void add(Bundle newBnd) {
+ Bundle current = get(newBnd, false);
+ if (current != null) {
+
+ } else {
+ StartLevel startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
+ startLevel.getBundles().add(newBnd);
+ }
+
+ }
+
+ private StartLevel getOrCreateStartLevel(int startLevel) {
+ for (StartLevel sl : getStartLevels()) {
+ if (sl.getLevel() == startLevel) {
+ return sl;
+ }
+ }
+
+ StartLevel sl = new StartLevel();
+ sl.setLevel(startLevel);
+ return sl;
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseStartLevel.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseStartLevel.java
new file mode 100644
index 0000000..b7e5923
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseStartLevel.java
@@ -0,0 +1,60 @@
+/*
+ * 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.bundlelist;
+
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.Bundle;
+
+public abstract class BaseStartLevel {
+
+ public abstract List<Bundle> getBundles();
+
+ public boolean removeBundle(Bundle bundle, boolean compareVersions) {
+ for (ListIterator<Bundle> it = getBundles().listIterator(); it.hasNext();) {
+ if (isSameArtifact(bundle, it.next(), compareVersions)) {
+ it.remove();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean containsBundle(Bundle bundle, boolean compareVersions) {
+ for (Bundle compare : getBundles()) {
+ return isSameArtifact(bundle, compare, compareVersions);
+ }
+ return false;
+ }
+
+ public Bundle getBundle(Bundle bundle, boolean compareVersions) {
+ for (Bundle compare : getBundles()) {
+ if (isSameArtifact(bundle, compare, compareVersions)) {
+ return compare;
+ }
+ }
+ return null;
+ }
+
+ private boolean isSameArtifact(Bundle bundle1, Bundle bundle2, boolean compareVersions) {
+ boolean result = compareVersions ? bundle1.getVersion().equals(bundle2) : true;
+ return result && bundle1.getArtifactId().equals(bundle2.getArtifactId())
+ && bundle1.getGroupId().equals(bundle2.getGroupId()) && bundle1.getType().equals(bundle2.getType());
+ }
+
+}
diff --git a/src/main/mdo/bundle-list.xml b/src/main/mdo/bundle-list.xml
index db071ab..8c078b2 100644
--- a/src/main/mdo/bundle-list.xml
+++ b/src/main/mdo/bundle-list.xml
@@ -35,6 +35,7 @@
<name>BundleList</name>
<description>List of bundles.</description>
<version>1.0.0</version>
+ <superClass>org.apache.sling.maven.projectsupport.bundlelist.BaseBundleList</superClass>
<fields>
<field>
<name>startLevels</name>
@@ -49,6 +50,7 @@
<class xml.tagName="startLevel">
<name>StartLevel</name>
<version>1.0.0</version>
+ <superClass>org.apache.sling.maven.projectsupport.bundlelist.BaseStartLevel</superClass>
<fields>
<field xml.attribute="true">
<name>level</name>
@@ -68,6 +70,7 @@
<class xml.tagName="bundle">
<name>Bundle</name>
<description>A bundle.</description>
+ <superClass>org.apache.sling.maven.projectsupport.bundlelist.BaseBundle</superClass>
<fields>
<field>
<name>groupId</name>
diff --git a/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
index c46f338..51fe815 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
@@ -35,8 +35,8 @@ public class PreparePackageMojoTest {
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", "RELEASE", "jar", "bundles", 0);
+ //makeArtifactAssertions(mojo, "defaultBundles", "org.apache.sling",
+ // "org.apache.sling.launchpad", "RELEASE", "jar", "bundles", 0);
makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling",
"org.apache.sling.launchpad", "RELEASE", "xml", "bundlelist", 0);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 42/49: [maven-release-plugin]
prepare release maven-launchpad-plugin-2.0.8
Posted by ro...@apache.org.
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 63eaf6eadc2efd8105116d3604813dd745119ee0
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Dec 14 04:34:55 2010 +0000
[maven-release-plugin] prepare release maven-launchpad-plugin-2.0.8
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1048934 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 23846e8..40ddb3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.0.7-SNAPSHOT</version>
+ <version>2.0.8</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -32,9 +32,9 @@
</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>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.8</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.8</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.0.8</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 49/49: [maven-scm] copy for tag
maven-launchpad-plugin-2.0.10
Posted by ro...@apache.org.
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 1b78d49c69d57e9aeb81b29aa71cc016c8582b0d
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Feb 15 02:04:47 2011 +0000
[maven-scm] copy for tag maven-launchpad-plugin-2.0.10
git-svn-id: https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.10@1070752 13f79535-47bb-0310-9956-ffa450edef68
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 48/49: [maven-release-plugin]
prepare release maven-launchpad-plugin-2.0.10
Posted by ro...@apache.org.
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 64e03a175213114251f9f2aed0886aac2962dc3d
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Feb 15 02:04:41 2011 +0000
[maven-release-plugin] prepare release maven-launchpad-plugin-2.0.10
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1070751 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 74572c7..edf3684 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.0.9-SNAPSHOT</version>
+ <version>2.0.10</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -32,9 +32,9 @@
</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>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.10</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.10</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.0.10</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 16/49: SLING-1491 - switching from
pax web to felix httpservice
Posted by ro...@apache.org.
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 dd65aa80d0b4defd61cd71dcc8d6fde17eefafc3
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Apr 16 14:53:27 2010 +0000
SLING-1491 - switching from pax web to felix httpservice
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@934949 13f79535-47bb-0310-9956-ffa450edef68
---
.../org/apache/sling/maven/projectsupport/dependencies.properties | 2 +-
.../apache/sling/maven/projectsupport/PreparePackageMojoTest.java | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
index c6803c1..89b1c3c 100644
--- a/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
+++ b/src/main/resources/org/apache/sling/maven/projectsupport/dependencies.properties
@@ -17,4 +17,4 @@
base=org.apache.sling,org.apache.sling.launchpad.base,,jar,,0
defaultBundles=org.apache.sling,org.apache.sling.launchpad,RELEASE,jar,bundles,0
defaultBundleList=org.apache.sling,org.apache.sling.launchpad,RELEASE,xml,bundlelist,0
-jarWebSupport=org.ops4j.pax.web,pax-web-service,RELEASE,jar,,5
+jarWebSupport=org.apache.felix,org.apache.felix.http.jetty,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
index 51fe815..9eb4fe4 100644
--- a/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
+++ b/src/test/java/org/apache/sling/maven/projectsupport/PreparePackageMojoTest.java
@@ -38,11 +38,11 @@ public class PreparePackageMojoTest {
//makeArtifactAssertions(mojo, "defaultBundles", "org.apache.sling",
// "org.apache.sling.launchpad", "RELEASE", "jar", "bundles", 0);
- makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling",
- "org.apache.sling.launchpad", "RELEASE", "xml", "bundlelist", 0);
+ makeArtifactAssertions(mojo, "defaultBundleList", "org.apache.sling",
+ "org.apache.sling.launchpad", "RELEASE", "xml", "bundlelist", 0);
- makeArtifactAssertions(mojo, "jarWebSupport", "org.ops4j.pax.web",
- "pax-web-service", "RELEASE", "jar", null, 5);
+ makeArtifactAssertions(mojo, "jarWebSupport", "org.apache.felix",
+ "org.apache.felix.http.jetty", "RELEASE", "jar", null, 5);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 27/49: SLING-1692 - replacing dummy
code for updated() method.
Posted by ro...@apache.org.
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 c52ad9c822064d4edfcabcef56c02d2d93c5c018
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Aug 24 16:22:40 2010 +0000
SLING-1692 - replacing dummy code for updated() method.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@988610 13f79535-47bb-0310-9956-ffa450edef68
---
.../AbstractLaunchpadStartingPlugin.java | 34 +++++++++++++++-------
.../apache/sling/maven/projectsupport/RunMojo.java | 9 ++++--
2 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
index f94cb3f..d0346c1 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
@@ -33,9 +33,9 @@ import org.osgi.framework.BundleException;
/**
* @author justin
- *
+ *
*/
-public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleListMojo implements Notifiable {
+public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleListMojo implements Notifiable {
/** Default log level setting if no set on command line (value is "INFO"). */
private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;
@@ -68,7 +68,7 @@ public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleList
/**
* The definition of the package to be included to provide web support for
* JAR-packaged projects (i.e. pax-web).
- *
+ *
* @parameter
*/
private ArtifactDefinition jarWebSupport;
@@ -169,16 +169,29 @@ public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleList
sling = null;
}
- public void updated(File tmpFile) {
- // TODO - should anything happen here?
- getLog().info("File updated " + tmpFile.getAbsolutePath());
+ public void updated(File updateFile) {
+ // clear the reference to the framework
+ sling = null;
+
+ if (updateFile != null) {
+ getLog().warn("Maven Launchpad Plugin doesn't support updating the framework bundle.");
+ }
+
+ getLog().info("Restarting Framework and Sling");
+
+ try {
+ executeWithArtifacts();
+ } catch (MojoExecutionException e) {
+ getLog().error("Unable to restart Framework and Sling", e);
+ System.exit(1);
+ }
}
/**
* {@inheritDoc}
*/
@Override
- protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ protected void executeWithArtifacts() throws MojoExecutionException {
try {
final Map<String, String> props = new HashMap<String, String>();
@@ -208,8 +221,8 @@ public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleList
File tmp = null;
try {
tmp = File.createTempFile("sling", "props");
- mavenFileFilter.copyFile(propertiesFile, tmp, true, project, null, true, System
- .getProperty("file.encoding"), mavenSession);
+ mavenFileFilter.copyFile(propertiesFile, tmp, true, project, null, true,
+ System.getProperty("file.encoding"), mavenSession);
Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
for (Object key : loadedProps.keySet()) {
props.put((String) key, (String) loadedProps.get(key));
@@ -233,7 +246,8 @@ public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleList
}
- protected abstract Sling startSling(ResourceProvider resourceProvider, Map<String, String> props, Logger logger) throws BundleException;
+ protected abstract Sling startSling(ResourceProvider resourceProvider, Map<String, String> props, Logger logger)
+ throws BundleException;
protected void stopSling() {
if (sling != null) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
index 248bd78..a337bf3 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -62,11 +62,16 @@ public class RunMojo extends AbstractLaunchpadStartingPlugin {
stopSling();
}
};
+
+ private boolean registeredHook = false;
protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
throws BundleException {
- Runtime.getRuntime().addShutdownHook(shutdown);
-
+ if (!registeredHook) {
+ Runtime.getRuntime().addShutdownHook(shutdown);
+ registeredHook = true;
+ }
+
// creating the instance launches the framework and we are done here
Sling mySling = new Sling(this, logger, resourceProvider, props) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 01/49: Introducing the
maven-launchpad-plugin and builder (fka uber) project described in
SLING-1197
Posted by ro...@apache.org.
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 <ju...@apache.org>
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
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 03/49: SLING-1322 - adding check to
avoid loading launchpad artifact if it's the same as the current project's
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag maven-launchpad-plugin-2.0.10
in repository https://gitbox.apache.org/repos/asf/sling-maven-launchpad-plugin.git
commit 1f5bd24e90df7fa8d4d4c97827626c2d1ddc6027
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Jan 25 21:39:32 2010 +0000
SLING-1322 - adding check to avoid loading launchpad artifact if it's the same as the current
project's
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@902985 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/AbstractBundleListMojo.java | 75 ++++++++++++----------
1 file changed, 42 insertions(+), 33 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 22ac54e..8aa3ae8 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -53,28 +53,28 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* The name of the directory within the output directory into which the base
* JAR should be installed.
- *
+ *
* @parameter default-value="resources"
*/
protected String baseDestination;
/**
* The directory which contains the start-level bundle directories.
- *
+ *
* @parameter default-value="bundles"
*/
protected String bundlesDirectory;
/**
* The definition of the defaultBundleList artifact.
- *
+ *
* @parameter
*/
private ArtifactDefinition defaultBundleList;
/**
* The definition of the defaultBundles package.
- *
+ *
* @parameter
*/
private ArtifactDefinition defaultBundles;
@@ -86,7 +86,7 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* To look up Archiver/UnArchiver implementations
- *
+ *
* @component
*/
private ArchiverManager archiverManager;
@@ -98,7 +98,7 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* The Maven project.
- *
+ *
* @parameter expression="${project}"
* @required
* @readonly
@@ -107,14 +107,14 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* Used to look up Artifacts in the remote repository.
- *
+ *
* @component
*/
private ArtifactFactory factory;
/**
* Location of the local repository.
- *
+ *
* @parameter expression="${localRepository}"
* @readonly
* @required
@@ -133,7 +133,7 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* List of Remote Repositories used by the resolver.
- *
+ *
* @parameter expression="${project.remoteArtifactRepositories}"
* @readonly
* @required
@@ -142,7 +142,7 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
* Used to look up Artifacts in the remote repository.
- *
+ *
* @component
*/
private ArtifactResolver resolver;
@@ -252,7 +252,7 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
return readBundleList(bundleListFile);
}
-
+
protected void outputBundleList(File outputDirectory)
throws MojoExecutionException {
try {
@@ -273,30 +273,39 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
bundleListFile), e);
}
- try {
- Artifact artifact = getArtifact(defaultBundleList.getGroupId(),
- defaultBundleList.getArtifactId(), defaultBundleList
- .getVersion(), defaultBundleList.getType(),
- defaultBundleList.getClassifier());
- getLog().info(
- "Using bundle list file from "
- + artifact.getFile().getAbsolutePath());
- BundleList bundles = readBundleList(artifact.getFile());
- copyBundles(bundles, outputDirectory);
- return;
- } catch (Exception e) {
- getLog()
- .warn(
- "Unable to load bundle list from artifact. Falling back to bundle jar",
- e);
+ if (!isCurrentArtifact(defaultBundleList)) {
+ try {
+ Artifact artifact = getArtifact(defaultBundleList.getGroupId(),
+ defaultBundleList.getArtifactId(), defaultBundleList
+ .getVersion(), defaultBundleList.getType(),
+ defaultBundleList.getClassifier());
+ getLog().info(
+ "Using bundle list file from "
+ + artifact.getFile().getAbsolutePath());
+ BundleList bundles = readBundleList(artifact.getFile());
+ copyBundles(bundles, outputDirectory);
+ return;
+ } catch (Exception e) {
+ getLog()
+ .warn(
+ "Unable to load bundle list from artifact. Falling back to bundle jar",
+ e);
+ }
}
- Artifact defaultBundlesArtifact = getArtifact(defaultBundles
- .getGroupId(), defaultBundles.getArtifactId(), defaultBundles
- .getVersion(), defaultBundles.getType(), defaultBundles
- .getClassifier());
- unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
- "META-INF/**");
+ if (!isCurrentArtifact(defaultBundleList)) {
+ Artifact defaultBundlesArtifact = getArtifact(defaultBundles
+ .getGroupId(), defaultBundles.getArtifactId(),
+ defaultBundles.getVersion(), defaultBundles.getType(),
+ defaultBundles.getClassifier());
+ unpack(defaultBundlesArtifact.getFile(), outputDirectory, null,
+ "META-INF/**");
+ }
+ }
+
+ private boolean isCurrentArtifact(ArtifactDefinition def) {
+ return (def.getGroupId().equals(project.getGroupId()) && def
+ .getArtifactId().equals(project.getArtifactId()));
}
private void copyBundles(BundleList bundles, File outputDirectory)
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 25/49: SLING-1586 - adding overwrite
version on merge code
Posted by ro...@apache.org.
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 c6c90d74fac02d375f2cdb2d6841003ea6feb7b9
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Sat Jul 3 02:15:29 2010 +0000
SLING-1586 - adding overwrite version on merge code
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@960149 13f79535-47bb-0310-9956-ffa450edef68
---
.../apache/sling/maven/projectsupport/AbstractBundleListMojo.java | 6 +++---
.../sling/maven/projectsupport/bundlelist/BaseBundleList.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 0c2fe4c..a0c3897 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -252,10 +252,10 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
} else {
bundleList = new BundleList();
if (includeDefaultBundles) {
- Artifact artifact = getArtifact(defaultBundleList.getGroupId(), defaultBundleList.getArtifactId(),
+ Artifact defBndListArtifact = getArtifact(defaultBundleList.getGroupId(), defaultBundleList.getArtifactId(),
defaultBundleList.getVersion(), defaultBundleList.getType(), defaultBundleList.getClassifier());
- getLog().info("Using bundle list file from " + artifact.getFile().getAbsolutePath());
- bundleList = readBundleList(artifact.getFile());
+ getLog().info("Using bundle list file from " + defBndListArtifact.getFile().getAbsolutePath());
+ bundleList = readBundleList(defBndListArtifact.getFile());
}
if (bundleListFile.exists()) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
index 97b185a..5bfc19f 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
@@ -78,7 +78,7 @@ public abstract class BaseBundleList {
private void add(StartLevel mergeStartLevel, Bundle newBnd) {
Bundle current = get(newBnd, false);
if (current != null) {
-
+ current.setVersion(newBnd.getVersion());
} else {
StartLevel startLevel = null;
if ( mergeStartLevel == null || newBnd.getStartLevel() > 0) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 20/49: [maven-release-plugin]
prepare for next development iteration
Posted by ro...@apache.org.
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 d69b5db49d2579b4534d5ca83a7d305f400877fa
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Apr 21 15:42:29 2010 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936362 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3dd0368..4dacf96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.0.6</version>
+ <version>2.0.7-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -32,9 +32,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.6</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.6</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.0.6</url>
+ <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>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 17/49: updating to released
launchpad base
Posted by ro...@apache.org.
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 eb5e8403c25a60d7304571bb7e8d0605c597b695
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Apr 21 15:34:57 2010 +0000
updating to released launchpad base
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936355 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index afb1f58..abda034 100644
--- a/pom.xml
+++ b/pom.xml
@@ -130,12 +130,12 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <version>2.2.0</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 22/49: Update some notice files
Posted by ro...@apache.org.
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 e75b10041893cf99819c109959502c8f1b4a1105
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Apr 22 05:33:02 2010 +0000
Update some notice files
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936617 13f79535-47bb-0310-9956-ffa450edef68
---
NOTICE | 2 +-
src/main/resources/META-INF/NOTICE | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/NOTICE b/NOTICE
index 64f7009..057ada1 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
Apache Sling Launchpad Maven Plugin
-Copyright 2008-2009 The Apache Software Foundation
+Copyright 2008-2010 The Apache Software Foundation
Apache Sling is based on source code originally developed
by Day Software (http://www.day.com/).
diff --git a/src/main/resources/META-INF/NOTICE b/src/main/resources/META-INF/NOTICE
index 6fd562c..7dbe7cb 100644
--- a/src/main/resources/META-INF/NOTICE
+++ b/src/main/resources/META-INF/NOTICE
@@ -1,5 +1,5 @@
Apache Sling Launchpad Maven Plugin
-Copyright 2008-2009 The Apache Software Foundation
+Copyright 2008-2010 The Apache Software Foundation
Apache Sling is based on source code originally developed
by Day Software (http://www.day.com/).
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 05/49: SLING-1323 - adding
"bundlesToRemove" option
Posted by ro...@apache.org.
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 b8899de2ac5c61237781df83a1bbd9fdb8903e99
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Jan 25 22:45:16 2010 +0000
SLING-1323 - adding "bundlesToRemove" option
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@903004 13f79535-47bb-0310-9956-ffa450edef68
---
.../maven/projectsupport/PreparePackageMojo.java | 28 +++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 3449740..262a6fa 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -23,7 +23,7 @@ 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.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
/**
@@ -45,6 +45,13 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
private ArtifactDefinition[] additionalBundles;
/**
+ * Bundles which should be removed from the project's bundles directory.
+ *
+ * @parameter
+ */
+ private ArtifactDefinition[] bundlesToRemove;
+
+ /**
* If true, install the default bundles.
*
* @parameter default-value="true"
@@ -97,11 +104,30 @@ public class PreparePackageMojo extends AbstractBundleListMojo {
}
copyAdditionalBundles();
copyWebSupportBundle();
+ removeBundles();
if (JAR.equals(packaging)) {
unpackBaseArtifact();
}
}
+ private void removeBundles() throws MojoExecutionException {
+ if (bundlesToRemove != null) {
+ File bundleBaseDir = new File(getOutputDirectory(), String.format(
+ "%s/%s", baseDestination, bundlesDirectory));
+
+ for (ArtifactDefinition def : bundlesToRemove) {
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir(bundleBaseDir);
+ scanner.setIncludes(new String[] { "**/" + def.getArtifactId() + "-*.*"});
+ scanner.scan();
+ for (String toRemove : scanner.getIncludedFiles()) {
+ getLog().info("Deleting " + toRemove);
+ new File(toRemove).delete();
+ }
+ }
+ }
+ }
+
private void copyAdditionalBundles() throws MojoExecutionException {
if (additionalBundles != null) {
for (int i = 0; i < additionalBundles.length; i++) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 13/49: exposing controlHost
configuration parameter in launchpad plugin
Posted by ro...@apache.org.
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 74b72b99bc4dbb9ca43b2c1719f2629273a7c202
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Apr 13 01:02:19 2010 +0000
exposing controlHost configuration parameter in launchpad plugin
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@933457 13f79535-47bb-0310-9956-ffa450edef68
---
src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
index 7be272a..ee89dff 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
@@ -38,12 +38,17 @@ public class StartMojo extends AbstractLaunchpadStartingPlugin {
private int controlPort;
/**
+ * @parameter expression="${sling.control.host}"
+ */
+ private String controlHost;
+
+ /**
* {@inheritDoc}
*/
@Override
protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
throws BundleException {
- new ControlListener(this, getLog(), null, controlPort).listen();
+ new ControlListener(this, getLog(), controlHost, controlPort).listen();
return new Sling(this, logger, resourceProvider, props) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 44/49: SLING-1597 - adding config
installation via launchpad
Posted by ro...@apache.org.
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 61f3f68f56de076696fdba84ed5bbf3b80227469
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Dec 20 16:15:25 2010 +0000
SLING-1597 - adding config installation via launchpad
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1051167 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 9 +-
.../projectsupport/AbstractBundleListMojo.java | 10 +++
.../AbstractLaunchpadStartingMojo.java | 97 +++++++++++++++++-----
.../maven/projectsupport/PreparePackageMojo.java | 12 ++-
.../apache/sling/maven/projectsupport/RunMojo.java | 4 +-
.../sling/maven/projectsupport/StartMojo.java | 4 +-
6 files changed, 108 insertions(+), 28 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4d6ad74..80513cb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -137,13 +137,18 @@
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.api</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
<classifier>app</classifier>
</dependency>
<dependency>
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
index 73b31ef..7201bd3 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractBundleListMojo.java
@@ -52,6 +52,12 @@ import org.drools.runtime.StatefulKnowledgeSession;
public abstract class AbstractBundleListMojo extends AbstractMojo {
/**
+ * @parameter expression="${configDirectory}"
+ * default-value="src/main/config"
+ */
+ protected File configDirectory;
+
+ /**
* JAR Packaging type.
*/
protected static final String JAR = "jar";
@@ -61,6 +67,10 @@ public abstract class AbstractBundleListMojo extends AbstractMojo {
*/
protected static final String WAR = "war";
+ protected static final String CONFIG_PATH_PREFIX = "resources/config";
+
+ protected static final String BUNDLE_PATH_PREFIX = "resources/bundles";
+
protected static boolean shouldCopy(File source, File dest) {
if (!dest.exists()) {
return true;
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 29004a6..6c5c4fd 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -19,7 +19,11 @@ package org.apache.sling.maven.projectsupport;
import static org.apache.felix.framework.util.FelixConstants.*;
import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -37,7 +41,7 @@ import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.shared.filtering.MavenFileFilter;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.PropertyUtils;
-import org.apache.sling.launchpad.base.impl.ResourceProvider;
+import org.apache.sling.launchpad.api.LaunchpadContentProvider;
import org.apache.sling.launchpad.base.impl.Sling;
import org.apache.sling.launchpad.base.shared.Notifiable;
import org.apache.sling.launchpad.base.shared.SharedConstants;
@@ -46,10 +50,6 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.BundleList;
import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
import org.osgi.framework.BundleException;
-/**
- * Base plugin class for goals which start Sling.
- *
- */
public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMojo implements Notifiable {
/** Default log level setting if no set on command line (value is "INFO"). */
@@ -101,7 +101,7 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
/**
* @parameter expression="${resourceProviderRoot}"
- * default-value="src/test/resources"
+ * default-value="src/test/resources"
*/
private File resourceProviderRoot;
@@ -110,22 +110,51 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
*/
private MavenFileFilter mavenFileFilter;
- private ResourceProvider resourceProvider = new ResourceProvider() {
+ /**
+ * @parameter expression="${session}"
+ * @required
+ * @readonly
+ */
+ private MavenSession mavenSession;
+
+ private LaunchpadContentProvider resourceProvider = new LaunchpadContentProvider() {
- @Override
public Iterator<String> getChildren(String path) {
- if (path.equals("resources/bundles")) {
+ if (path.equals(BUNDLE_PATH_PREFIX)) {
List<String> levels = new ArrayList<String>();
for (StartLevel level : getBundleList().getStartLevels()) {
- levels.add(String.valueOf(level.getLevel()) + "/");
+ levels.add(String.valueOf(BUNDLE_PATH_PREFIX + "/" + level.getLevel()) + "/");
}
return levels.iterator();
} else if (path.equals("resources/corebundles")) {
List<String> empty = Collections.emptyList();
return empty.iterator();
- } else {
+ } else if (path.equals(CONFIG_PATH_PREFIX)) {
+ if (configDirectory.exists() && configDirectory.isDirectory()) {
+ File[] configFiles = configDirectory.listFiles(new FileFilter() {
+
+ public boolean accept(File file) {
+ return file.isFile();
+ }
+ });
+
+ List<String> fileNames = new ArrayList<String>();
+ for (File cfgFile : configFiles) {
+ if (cfgFile.isFile()) {
+ fileNames.add(CONFIG_PATH_PREFIX + "/" + cfgFile.getName());
+ }
+ }
+
+ return fileNames.iterator();
+
+ } else {
+ List<String> empty = Collections.emptyList();
+ return empty.iterator();
+ }
+ } else if (path.startsWith(BUNDLE_PATH_PREFIX)) {
+ String startLevel = path.substring(BUNDLE_PATH_PREFIX.length() + 1);
try {
- int i = Integer.parseInt(path);
+ int i = Integer.parseInt(startLevel);
List<String> bundles = new ArrayList<String>();
for (StartLevel level : getBundleList().getStartLevels()) {
if (level.getLevel() == i) {
@@ -145,15 +174,25 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
return bundles.iterator();
} catch (NumberFormatException e) {
- getLog().warn("un-handlable path " + path);
- return null;
-
}
}
+
+ getLog().warn("un-handlable path " + path);
+ return null;
}
- @Override
public URL getResource(String path) {
+ if (path.startsWith(CONFIG_PATH_PREFIX)) {
+ File configFile = new File(configDirectory, path.substring(CONFIG_PATH_PREFIX.length() + 1));
+ if (configFile.exists()) {
+ try {
+ return configFile.toURI().toURL();
+ } catch (MalformedURLException e) {
+ // ignore this one
+ }
+ }
+ }
+
File resourceFile = new File(resourceProviderRoot, path);
if (resourceFile.exists()) {
try {
@@ -167,13 +206,29 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
if (fromClasspath != null) {
return fromClasspath;
}
-
+
try {
return new URL(path);
} catch (MalformedURLException e) {
return null;
}
}
+
+ }
+
+ public InputStream getResourceAsStream(String path) {
+ URL res = this.getResource(path);
+ if (res != null) {
+ try {
+ return res.openStream();
+ } catch (IOException ioe) {
+ // ignore this one
+ }
+ }
+
+ // no resource
+ return null;
+
}
};
@@ -200,9 +255,9 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
if (updateFile != null) {
getLog().warn("Maven Launchpad Plugin doesn't support updating the framework bundle.");
}
-
+
getLog().info("Restarting Framework and Sling");
-
+
try {
executeWithArtifacts();
} catch (MojoExecutionException e) {
@@ -270,8 +325,8 @@ public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMo
}
- protected abstract Sling startSling(ResourceProvider resourceProvider, Map<String, String> props, Logger logger)
- throws BundleException;
+ protected abstract Sling startSling(LaunchpadContentProvider resourceProvider, Map<String, String> props,
+ Logger logger) throws BundleException;
protected void stopSling() {
if (sling != null) {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
index 55629db..1fdc8c0 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/PreparePackageMojo.java
@@ -92,12 +92,13 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
public void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
copyBaseArtifact();
copyBundles(getBundleList(), getOutputDirectory());
+ copyConfigurationFiles();
if (JAR.equals(packaging)) {
unpackBaseArtifact();
}
}
- protected void initArtifactDefinitions(Properties dependencies) {
+ protected void initArtifactDefinitions(Properties dependencies) {
if (base == null) {
base = new ArtifactDefinition();
}
@@ -186,6 +187,15 @@ public class PreparePackageMojo extends AbstractLaunchpadFrameworkMojo {
unpack(artifact.getFile(), buildOutputDirectory, null, null);
}
+ private void copyConfigurationFiles() throws MojoExecutionException {
+ try {
+ FileUtils.copyDirectory(configDirectory, new File(getOutputDirectory(), CONFIG_PATH_PREFIX));
+ } catch (IOException e) {
+ throw new MojoExecutionException("Unable to copy configuration files", e);
+ }
+
+ }
+
private void unpack(File source, File destination, String includes, String excludes)
throws MojoExecutionException {
getLog().info("Unpacking " + source.getPath() + " to\n " + destination.getPath());
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
index a00133a..feaecd5 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -19,7 +19,7 @@ package org.apache.sling.maven.projectsupport;
import java.util.Map;
import org.apache.felix.framework.Logger;
-import org.apache.sling.launchpad.base.impl.ResourceProvider;
+import org.apache.sling.launchpad.api.LaunchpadContentProvider;
import org.apache.sling.launchpad.base.impl.Sling;
import org.osgi.framework.BundleException;
@@ -65,7 +65,7 @@ public class RunMojo extends AbstractLaunchpadStartingMojo {
private boolean registeredHook = false;
- protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
+ protected Sling startSling(LaunchpadContentProvider resourceProvider, final Map<String, String> props, Logger logger)
throws BundleException {
if (!registeredHook) {
Runtime.getRuntime().addShutdownHook(shutdown);
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
index e83a75b..4a48571 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
@@ -19,7 +19,7 @@ package org.apache.sling.maven.projectsupport;
import java.util.Map;
import org.apache.felix.framework.Logger;
-import org.apache.sling.launchpad.base.impl.ResourceProvider;
+import org.apache.sling.launchpad.api.LaunchpadContentProvider;
import org.apache.sling.launchpad.base.impl.Sling;
import org.osgi.framework.BundleException;
@@ -46,7 +46,7 @@ public class StartMojo extends AbstractLaunchpadStartingMojo {
* {@inheritDoc}
*/
@Override
- protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
+ protected Sling startSling(LaunchpadContentProvider resourceProvider, final Map<String, String> props, Logger logger)
throws BundleException {
new ControlListener(this, getLog(), controlHost, controlPort).listen();
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 43/49: [maven-release-plugin]
prepare for next development iteration
Posted by ro...@apache.org.
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 9fd2bdb18f56d91e64cc0605b686b636b18f1821
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Dec 14 04:35:06 2010 +0000
[maven-release-plugin] prepare for next development iteration
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1048936 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 40ddb3d..4d6ad74 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.0.8</version>
+ <version>2.0.9-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -32,9 +32,9 @@
</description>
<scm>
- <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.8</connection>
- <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.8</developerConnection>
- <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.0.8</url>
+ <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>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 35/49: updating all modules to
parent 10-SNAPSHOT in anticipation of emma additions to parent
Posted by ro...@apache.org.
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 cbb45d415f404ea9b49d5a849432aeadaec9711a
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Oct 13 20:54:21 2010 +0000
updating all modules to parent 10-SNAPSHOT in anticipation of emma additions to parent
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1022288 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index 8f226ae..81537e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling</artifactId>
- <version>9</version>
+ <version>10-SNAPSHOT</version>
<relativePath>../../parent/pom.xml</relativePath>
</parent>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 09/49: SLING-1351 When the xpp
parser loads a Bundle it only sets the attributes specified on the bundle,
and takes no account of any containers,
hence on merge the container start level must be inspected to determine
where a bundle should be merged. If not specified (ie 0) it should be
merged in the containing bundle. This means that its not going to be
possible to specify a bundle as loading in start level 0 by setting the
level on the bundle. To load in start level 0 you must put the bundle el
[...]
Posted by ro...@apache.org.
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 d2e796202ebf17b280410749a919c83d361f977a
Author: Ian Boston <ie...@apache.org>
AuthorDate: Wed Feb 24 16:42:32 2010 +0000
SLING-1351 When the xpp parser loads a Bundle it only sets the attributes specified on the bundle, and takes no account of
any containers, hence on merge the container start level must be inspected to determine where a bundle should be merged.
If not specified (ie 0) it should be merged in the containing bundle. This means that its not going to be possible
to specify a bundle as loading in start level 0 by setting the level on the bundle. To load in start level 0 you must
put the bundle element inside a startLevel element of 0.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@915859 13f79535-47bb-0310-9956-ffa450edef68
---
.../projectsupport/bundlelist/BaseBundleList.java | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
index 43b78fc..97b185a 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/bundlelist/BaseBundleList.java
@@ -55,7 +55,7 @@ public abstract class BaseBundleList {
public void merge(BundleList bundleList) {
for (StartLevel sl : bundleList.getStartLevels()) {
for (Bundle bnd : sl.getBundles()) {
- add(bnd);
+ add(sl, bnd);
}
}
}
@@ -67,11 +67,25 @@ public abstract class BaseBundleList {
* @param newBnd the bundle to add
*/
public void add(Bundle newBnd) {
+ add(null, newBnd);
+ }
+
+ /**
+ * Merge bundle into a start level using the supplied level if present.
+ * @param mergeStartLevel
+ * @param newBnd
+ */
+ private void add(StartLevel mergeStartLevel, Bundle newBnd) {
Bundle current = get(newBnd, false);
if (current != null) {
} else {
- StartLevel startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
+ StartLevel startLevel = null;
+ if ( mergeStartLevel == null || newBnd.getStartLevel() > 0) {
+ startLevel = getOrCreateStartLevel(newBnd.getStartLevel());
+ } else {
+ startLevel = getOrCreateStartLevel(mergeStartLevel.getLevel());
+ }
startLevel.getBundles().add(newBnd);
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 15/49: SLING-1442 - shouldn't be
killing the JVM on a "stop" command.
Posted by ro...@apache.org.
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 9768cfb171a8759519d98557827e8319c6eecb73
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Apr 16 14:53:17 2010 +0000
SLING-1442 - shouldn't be killing the JVM on a "stop" command.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@934948 13f79535-47bb-0310-9956-ffa450edef68
---
.../java/org/apache/sling/maven/projectsupport/ControlListener.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
index dd60568..65adf23 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
@@ -124,8 +124,8 @@ class ControlListener implements Runnable {
}
writeLine(s, RESPONSE_OK);
- log.info("Sling shut down, exiting Java VM");
- System.exit(0);
+ log.info("Sling shut down, stopping Sling.");
+ mojo.stopSling();
} else if (COMMAND_STATUS.equals(command)) {
writeLine(s, RESPONSE_OK);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 45/49: removing LICENSE and NOTICE
files for future releases
Posted by ro...@apache.org.
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 c0518dae3b2eeba229f1cc5dd7d078218c8dbc73
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Dec 20 16:20:17 2010 +0000
removing LICENSE and NOTICE files for future releases
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1051181 13f79535-47bb-0310-9956-ffa450edef68
---
LICENSE | 202 ----------------------------------------------------------------
NOTICE | 9 ---
2 files changed, 211 deletions(-)
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index d645695..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- 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
deleted file mode 100644
index 057ada1..0000000
--- a/NOTICE
+++ /dev/null
@@ -1,9 +0,0 @@
-Apache Sling Launchpad Maven Plugin
-Copyright 2008-2010 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/).
-
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 23/49: Use released version of
launchpad base
Posted by ro...@apache.org.
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 2551177e93d6931322639e17063e39166ca8d88b
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Apr 28 09:03:59 2010 +0000
Use released version of launchpad base
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@938826 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 7db8e1b..4dacf96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,12 +129,12 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.1-SNAPSHOT</version>
+ <version>2.2.0</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 28/49: SLING-1693 - adding xml as a
resource provider provided extension
Posted by ro...@apache.org.
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 294514545387a82923b77bcc49f722127d2d1a10
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Aug 24 16:26:45 2010 +0000
SLING-1693 - adding xml as a resource provider provided extension
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@988612 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
index d0346c1..737de43 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
@@ -140,7 +140,7 @@ public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleList
@Override
public URL getResource(String path) {
- if (path.endsWith(".properties")) {
+ if (path.endsWith(".properties") || path.endsWith(".xml")) {
return getClass().getResource("/" + path);
} else {
try {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 21/49: using next snapshot until
release vote is finished
Posted by ro...@apache.org.
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 2e9d1947fa831dc85cefb67895e5a8ddbef71ff4
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Apr 21 20:00:49 2010 +0000
using next snapshot until release vote is finished
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936470 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index 4dacf96..7db8e1b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,12 +129,12 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.2.0</version>
+ <version>2.2.1-SNAPSHOT</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 19/49: [maven-release-plugin]
prepare release maven-launchpad-plugin-2.0.6
Posted by ro...@apache.org.
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 cc7a04fc3a38a760b8ab4723ac3e31bdb79c4d53
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Apr 21 15:42:21 2010 +0000
[maven-release-plugin] prepare release maven-launchpad-plugin-2.0.6
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@936360 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/pom.xml b/pom.xml
index 526aafe..3dd0368 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<groupId>org.apache.sling</groupId>
<artifactId>maven-launchpad-plugin</artifactId>
- <version>2.0.5-SNAPSHOT</version>
+ <version>2.0.6</version>
<packaging>maven-plugin</packaging>
<name>Apache Sling Launchpad Maven Plugin</name>
@@ -32,9 +32,9 @@
</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>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.6</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/tags/maven-launchpad-plugin-2.0.6</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/tags/maven-launchpad-plugin-2.0.6</url>
</scm>
<build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 36/49: adding jboss repository (for
drools dependencies)
Posted by ro...@apache.org.
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 25154c38724f6be134331f453529df97af176e37
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Oct 13 20:54:29 2010 +0000
adding jboss repository (for drools dependencies)
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1022289 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/pom.xml b/pom.xml
index 81537e4..cbf12cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -153,4 +153,17 @@
<version>5.1.1</version>
</dependency>
</dependencies>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 38/49: SLING-1803 - adding emma
report. runs with -P emma
Posted by ro...@apache.org.
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 85a3ca69532dc403c5bf046235560d9373ff4753
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Sun Oct 17 16:30:16 2010 +0000
SLING-1803 - adding emma report. runs with -P emma
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1023522 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/pom.xml b/pom.xml
index cbf12cd..c32b3e5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -66,6 +66,15 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>emma-maven-plugin</artifactId>
+ <configuration>
+ <filters>
+ <filter>-*</filter>
+ </filters>
+ </configuration>
+ </plugin>
</plugins>
</build>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 29/49: changing classname and adding
missing license header
Posted by ro...@apache.org.
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 42035b5db6332370b01d71d0398f206067680705
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Aug 24 18:07:20 2010 +0000
changing classname and adding missing license header
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@988639 13f79535-47bb-0310-9956-ffa450edef68
---
...ugin.java => AbstractLaunchpadStartingMojo.java} | 21 ++++++++++++++++++---
.../sling/maven/projectsupport/ControlListener.java | 4 ++--
.../apache/sling/maven/projectsupport/RunMojo.java | 2 +-
.../sling/maven/projectsupport/StartMojo.java | 2 +-
4 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
similarity index 90%
rename from src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
rename to src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
index 737de43..1bd8cb1 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingMojo.java
@@ -1,3 +1,19 @@
+/*
+ * 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 static org.apache.felix.framework.util.FelixConstants.*;
@@ -18,7 +34,6 @@ import org.apache.felix.framework.Logger;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.shared.filtering.MavenFileFilter;
import org.apache.maven.shared.filtering.MavenFilteringException;
import org.apache.maven.shared.filtering.PropertyUtils;
@@ -32,10 +47,10 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
import org.osgi.framework.BundleException;
/**
- * @author justin
+ * Base plugin class for goals which start Sling.
*
*/
-public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleListMojo implements Notifiable {
+public abstract class AbstractLaunchpadStartingMojo extends AbstractBundleListMojo implements Notifiable {
/** Default log level setting if no set on command line (value is "INFO"). */
private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
index 65adf23..3e3dba5 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
@@ -48,7 +48,7 @@ class ControlListener implements Runnable {
private static final int DEFAULT_LISTEN_PORT = 63000;
/** The mojo */
- private AbstractLaunchpadStartingPlugin mojo;
+ private AbstractLaunchpadStartingMojo mojo;
/** The log object */
private final Log log;
@@ -56,7 +56,7 @@ class ControlListener implements Runnable {
/** The socket address used for control communication */
private final SocketAddress socketAddress;
- ControlListener(AbstractLaunchpadStartingPlugin mojo, Log log, String host, int port) {
+ ControlListener(AbstractLaunchpadStartingMojo mojo, Log log, String host, int port) {
this.mojo = mojo;
this.log = log;
this.socketAddress = getSocketAddress(host, port);
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
index a337bf3..a00133a 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -30,7 +30,7 @@ import org.osgi.framework.BundleException;
* @requiresDependencyResolution test
*
*/
-public class RunMojo extends AbstractLaunchpadStartingPlugin {
+public class RunMojo extends AbstractLaunchpadStartingMojo {
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
index ee89dff..e83a75b 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
@@ -30,7 +30,7 @@ import org.osgi.framework.BundleException;
* @requiresDependencyResolution test
*
*/
-public class StartMojo extends AbstractLaunchpadStartingPlugin {
+public class StartMojo extends AbstractLaunchpadStartingMojo {
/**
* @parameter expression="${sling.control.port}" default-value="63000"
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 12/49: SLING-1442 - adding start and
stop goals to launchpad plugin
Posted by ro...@apache.org.
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 df85fd611eed2945f2608965dd2f0ac96831d3d5
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Mon Apr 12 17:36:43 2010 +0000
SLING-1442 - adding start and stop goals to launchpad plugin
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@933332 13f79535-47bb-0310-9956-ffa450edef68
---
...o.java => AbstractLaunchpadStartingPlugin.java} | 77 +------
.../maven/projectsupport/ControlListener.java | 212 +++++++++++++++++
.../apache/sling/maven/projectsupport/RunMojo.java | 253 ++-------------------
.../sling/maven/projectsupport/StartMojo.java | 62 +++++
.../sling/maven/projectsupport/StatusMojo.java | 49 ++++
.../sling/maven/projectsupport/StopMojo.java | 49 ++++
6 files changed, 401 insertions(+), 301 deletions(-)
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
similarity index 77%
copy from src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
copy to src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
index 061ecd8..f94cb3f 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/AbstractLaunchpadStartingPlugin.java
@@ -1,19 +1,3 @@
-/*
- * 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 static org.apache.felix.framework.util.FelixConstants.*;
@@ -24,7 +8,6 @@ import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -49,13 +32,10 @@ import org.apache.sling.maven.projectsupport.bundlelist.v1_0_0.StartLevel;
import org.osgi.framework.BundleException;
/**
- * Run a Launchpad application.
- *
- * @goal run
- * @requiresDependencyResolution test
+ * @author justin
*
*/
-public class RunMojo extends AbstractBundleListMojo implements Notifiable {
+public abstract class AbstractLaunchpadStartingPlugin extends AbstractBundleListMojo implements Notifiable {
/** Default log level setting if no set on command line (value is "INFO"). */
private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;
@@ -173,39 +153,6 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
}
};
- private Thread shutdown = new Thread() {
- /**
- * Called when the Java VM is being terminiated, for example because the
- * KILL signal has been sent to the process. This method calls stop on
- * the launched Sling instance to terminate the framework before
- * returning.
- */
- @Override
- public void run() {
- getLog().info("Java VM is shutting down", null);
- shutdown();
- }
-
- // ---------- Shutdown support for control listener and shutdown hook
-
- void shutdown() {
- // remove the shutdown hook, will fail if called from the
- // shutdown hook itself. Otherwise this prevents shutdown
- // from being called again
- try {
- Runtime.getRuntime().removeShutdownHook(this);
- } catch (Throwable t) {
- // don't care for problems removing the hook
- }
-
- // now really shutdown sling
- if (sling != null) {
- getLog().info("Stopping Sling", null);
- sling.destroy();
- }
- }
- };
-
private Sling sling;
/**
@@ -232,8 +179,6 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
*/
@Override
protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
- Runtime.getRuntime().addShutdownHook(shutdown);
-
try {
final Map<String, String> props = new HashMap<String, String>();
@@ -280,21 +225,22 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
}
}
- // creating the instance launches the framework and we are done here
- sling = new Sling(this, logger, resourceProvider, props);
-
- // TODO this seems hacky!
- while (sling != null) {
- Thread.sleep(100);
- }
+ sling = startSling(resourceProvider, props, logger);
} catch (BundleException be) {
getLog().error("Failed to Start OSGi framework", be);
- } catch (InterruptedException e) {
}
}
+ protected abstract Sling startSling(ResourceProvider resourceProvider, Map<String, String> props, Logger logger) throws BundleException;
+
+ protected void stopSling() {
+ if (sling != null) {
+ sling.destroy();
+ }
+ }
+
protected void initArtifactDefinitions(Properties dependencies) {
if (jarWebSupport == null) {
jarWebSupport = new ArtifactDefinition();
@@ -309,5 +255,4 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
protected void initBundleList(BundleList bundleList) {
bundleList.add(jarWebSupport.toBundle());
}
-
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
new file mode 100644
index 0000000..dd60568
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/ControlListener.java
@@ -0,0 +1,212 @@
+/*
+ * 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.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.ConnectException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketAddress;
+import java.net.UnknownHostException;
+
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * This class is adapted from org.apache.sling.launchpad.app.ControlListener.
+ */
+class ControlListener implements Runnable {
+ // command sent by the client to cause Sling to shutdown
+ static final String COMMAND_STOP = "stop";
+
+ // command sent by the client to check for the status of the server
+ static final String COMMAND_STATUS = "status";
+
+ // the response sent by the server if the command executed successfully
+ private static final String RESPONSE_OK = "OK";
+
+ // The default port to listen on and to connect to
+ private static final int DEFAULT_LISTEN_PORT = 63000;
+
+ /** The mojo */
+ private AbstractLaunchpadStartingPlugin mojo;
+
+ /** The log object */
+ private final Log log;
+
+ /** The socket address used for control communication */
+ private final SocketAddress socketAddress;
+
+ ControlListener(AbstractLaunchpadStartingPlugin mojo, Log log, String host, int port) {
+ this.mojo = mojo;
+ this.log = log;
+ this.socketAddress = getSocketAddress(host, port);
+ }
+
+ /**
+ * Implements the server side of the control connection starting a thread
+ * listening on the host and port configured on setup of this instance.
+ */
+ void listen() {
+ if (socketAddress != null) {
+ Thread listener = new Thread(this);
+ listener.setDaemon(true);
+ listener.setName("Sling Control Listener@" + socketAddress);
+ listener.start();
+ } else {
+ log.info("No socket address to listen to");
+ }
+ }
+
+ /**
+ * Implements the client side of the control connection sending the command
+ * to shutdown Sling.
+ */
+ void shutdownServer() {
+ sendCommand(COMMAND_STOP);
+ }
+
+ /**
+ * Implements the client side of the control connection sending the command
+ * to check whether Sling is active.
+ */
+ void statusServer() {
+ sendCommand(COMMAND_STATUS);
+ }
+
+ // ---------- Runnable interface
+
+ /**
+ * Implements the server thread receiving commands from clients and acting
+ * upon them.
+ */
+ public void run() {
+ ServerSocket server = null;
+ try {
+ server = new ServerSocket();
+ server.bind(socketAddress);
+ log.info("Sling Control Server started on " + socketAddress.toString());
+ } catch (IOException ioe) {
+ log.error("Failed to start Sling Control Server", ioe);
+ return;
+ }
+
+ try {
+ while (true) {
+
+ Socket s = server.accept();
+ try {
+ String command = readLine(s);
+ log.info(s.getRemoteSocketAddress() + ">" + command);
+
+ if (COMMAND_STOP.equals(command)) {
+ if (mojo != null) {
+ mojo.stopSling();
+ }
+ writeLine(s, RESPONSE_OK);
+
+ log.info("Sling shut down, exiting Java VM");
+ System.exit(0);
+
+ } else if (COMMAND_STATUS.equals(command)) {
+ writeLine(s, RESPONSE_OK);
+
+ } else {
+ writeLine(s, "ERR:" + command);
+
+ }
+ } finally {
+ try {
+ s.close();
+ } catch (IOException ignore) {
+ }
+ }
+ }
+ } catch (IOException ioe) {
+ log.error("Failure reading from client", ioe);
+ } finally {
+ try {
+ server.close();
+ } catch (IOException ignore) {
+ }
+ }
+ }
+
+ // ---------- socket support
+
+ private SocketAddress getSocketAddress(String host, int port) {
+ try {
+ if (port == -1) {
+ port = DEFAULT_LISTEN_PORT;
+ }
+
+ if (host != null) {
+ return new InetSocketAddress(host, port);
+ } else {
+
+ return new InetSocketAddress(InetAddress.getLocalHost(), port);
+ }
+ } catch (UnknownHostException uhe) {
+ log.error("Unknown host in '" + host + "': " + uhe.getMessage(), null);
+ }
+
+ return null;
+ }
+
+ private void sendCommand(String command) {
+ if (socketAddress != null) {
+ Socket socket = null;
+ try {
+ socket = new Socket();
+ socket.connect(socketAddress);
+ writeLine(socket, command);
+ String result = readLine(socket);
+ log.info("Sent '" + command + "' to " + socketAddress + ": " + result, null);
+ } catch (ConnectException ce) {
+ log.info("No Sling running at " + socketAddress, null);
+ } catch (IOException ioe) {
+ log.error("Failed sending '" + command + "' to " + socketAddress, ioe);
+ } finally {
+ if (socket != null) {
+ try {
+ socket.close();
+ } catch (IOException ignore) {
+ }
+ }
+ }
+ } else {
+ log.info("No socket address to send '" + command + "' to", null);
+ }
+ }
+
+ private String readLine(Socket socket) throws IOException {
+ BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream(), "UTF-8"));
+ return br.readLine();
+ }
+
+ private void writeLine(Socket socket, String line) throws IOException {
+ BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), "UTF-8"));
+ bw.write(line);
+ bw.write("\r\n");
+ bw.flush();
+ }
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
index 061ecd8..248bd78 100644
--- a/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
+++ b/src/main/java/org/apache/sling/maven/projectsupport/RunMojo.java
@@ -16,36 +16,11 @@
*/
package org.apache.sling.maven.projectsupport;
-import static org.apache.felix.framework.util.FelixConstants.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
-import java.util.Properties;
import org.apache.felix.framework.Logger;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.shared.filtering.MavenFileFilter;
-import org.apache.maven.shared.filtering.MavenFilteringException;
-import org.apache.maven.shared.filtering.PropertyUtils;
import org.apache.sling.launchpad.base.impl.ResourceProvider;
import org.apache.sling.launchpad.base.impl.Sling;
-import org.apache.sling.launchpad.base.shared.Notifiable;
-import org.apache.sling.launchpad.base.shared.SharedConstants;
-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.osgi.framework.BundleException;
/**
@@ -55,123 +30,9 @@ import org.osgi.framework.BundleException;
* @requiresDependencyResolution test
*
*/
-public class RunMojo extends AbstractBundleListMojo implements Notifiable {
-
- /** Default log level setting if no set on command line (value is "INFO"). */
- private static final int DEFAULT_LOG_LEVEL = Logger.LOG_INFO;
-
- /** Mapping between log level numbers and names */
- private static final String[] logLevels = { "FATAL", "ERROR", "WARN", "INFO", "DEBUG" };
-
- /**
- * The configuration property setting the port on which the HTTP service
- * listens
- */
- private static final String PROP_PORT = "org.osgi.service.http.port";
-
- /** Return the log level code for the string */
- private static int toLogLevelInt(String level, int defaultLevel) {
- for (int i = 0; i < logLevels.length; i++) {
- if (logLevels[i].equalsIgnoreCase(level)) {
- return i;
- }
- }
-
- return defaultLevel;
- }
-
- /**
- * @parameter expression="${http.port}" default-value="8080"
- */
- private int httpPort;
-
- /**
- * The definition of the package to be included to provide web support for
- * JAR-packaged projects (i.e. pax-web).
- *
- * @parameter
- */
- private ArtifactDefinition jarWebSupport;
-
- /**
- * @parameter expression="${felix.log.level}"
- */
- private String logLevel;
-
- /**
- * @parameter expression="${propertiesFile}"
- * default-value="src/test/config/sling.properties"
- */
- private File propertiesFile;
+public class RunMojo extends AbstractLaunchpadStartingPlugin {
- /**
- * @component
- */
- private MavenFileFilter mavenFileFilter;
- /**
- * @parameter expression="${session}"
- * @required
- * @readonly
- */
- private MavenSession mavenSession;
-
- private ResourceProvider resourceProvider = new ResourceProvider() {
-
- @Override
- public Iterator<String> getChildren(String path) {
- if (path.equals("resources/bundles")) {
- List<String> levels = new ArrayList<String>();
- for (StartLevel level : getBundleList().getStartLevels()) {
- levels.add(String.valueOf(level.getLevel()) + "/");
- }
- return levels.iterator();
- } else if (path.equals("resources/corebundles")) {
- List<String> empty = Collections.emptyList();
- return empty.iterator();
- } else {
- try {
- int i = Integer.parseInt(path);
- List<String> bundles = new ArrayList<String>();
- for (StartLevel level : getBundleList().getStartLevels()) {
- if (level.getLevel() == i) {
- for (Bundle bundle : level.getBundles()) {
- ArtifactDefinition d = new ArtifactDefinition(bundle, i);
- try {
- Artifact artifact = getArtifact(d);
- bundles.add(artifact.getFile().toURI().toURL().toExternalForm());
- } catch (Exception e) {
- getLog().error("Unable to resolve artifact ", e);
- }
- }
-
- break;
- }
- }
- return bundles.iterator();
-
- } catch (NumberFormatException e) {
- getLog().warn("un-handlable path " + path);
- return null;
-
- }
- }
- }
-
- @Override
- public URL getResource(String path) {
- if (path.endsWith(".properties")) {
- return getClass().getResource("/" + path);
- } else {
- try {
- return new URL(path);
- } catch (MalformedURLException e) {
- getLog().error("Expecting a real URL", e);
- return null;
- }
- }
- }
- };
private Thread shutdown = new Thread() {
/**
@@ -198,116 +59,38 @@ public class RunMojo extends AbstractBundleListMojo implements Notifiable {
// don't care for problems removing the hook
}
- // now really shutdown sling
- if (sling != null) {
- getLog().info("Stopping Sling", null);
- sling.destroy();
- }
+ stopSling();
}
};
- private Sling sling;
-
- /**
- * @parameter expression="${sling.home}" default-value="sling"
- */
- private String slingHome;
-
- /**
- * @parameter default-value="true"
- */
- private boolean forceBundleLoad;
-
- public void stopped() {
- sling = null;
- }
-
- public void updated(File tmpFile) {
- // TODO - should anything happen here?
- getLog().info("File updated " + tmpFile.getAbsolutePath());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void executeWithArtifacts() throws MojoExecutionException, MojoFailureException {
+ protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
+ throws BundleException {
Runtime.getRuntime().addShutdownHook(shutdown);
- try {
- final Map<String, String> props = new HashMap<String, String>();
-
- props.put(SharedConstants.SLING_HOME, slingHome);
+ // creating the instance launches the framework and we are done here
+ Sling mySling = new Sling(this, logger, resourceProvider, props) {
- if (forceBundleLoad) {
- props.put(SharedConstants.FORCE_PACKAGE_BUNDLE_LOADING, "true");
- }
-
- // set up and configure Felix Logger
- int logLevelNum;
- if (logLevel == null) {
- logLevelNum = DEFAULT_LOG_LEVEL;
- } else {
- logLevelNum = toLogLevelInt(logLevel, DEFAULT_LOG_LEVEL);
- }
- props.put(LOG_LEVEL_PROP, String.valueOf(logLevelNum));
- // Display port number on console, in case HttpService doesn't
- getLog().info("HTTP server port: " + httpPort);
- props.put(PROP_PORT, String.valueOf(httpPort));
-
- // prevent tons of needless WARN from the framework
- Logger logger = new Logger();
- logger.setLogLevel(Logger.LOG_ERROR);
-
- if (propertiesFile.exists()) {
- File tmp = null;
- try {
- tmp = File.createTempFile("sling", "props");
- mavenFileFilter.copyFile(propertiesFile, tmp, true, project, null, true, System
- .getProperty("file.encoding"), mavenSession);
- Properties loadedProps = PropertyUtils.loadPropertyFile(tmp, null);
- for (Object key : loadedProps.keySet()) {
- props.put((String) key, (String) loadedProps.get(key));
- }
- } catch (IOException e) {
- throw new MojoExecutionException("Unable to create filtered properties file", e);
- } catch (MavenFilteringException e) {
- throw new MojoExecutionException("Unable to create filtered properties file", e);
- } finally {
- if (tmp != null) {
- tmp.delete();
- }
+ // overwrite the loadPropertiesOverride method to inject the
+ // mojo arguments unconditionally. These will not be persisted
+ // in any properties file, though
+ protected void loadPropertiesOverride(
+ Map<String, String> properties) {
+ if (props != null) {
+ properties.putAll(props);
}
}
+ };
- // creating the instance launches the framework and we are done here
- sling = new Sling(this, logger, resourceProvider, props);
-
- // TODO this seems hacky!
- while (sling != null) {
+ // TODO this seems hacky!
+ try {
+ while (mySling != null) {
Thread.sleep(100);
}
-
- } catch (BundleException be) {
- getLog().error("Failed to Start OSGi framework", be);
} catch (InterruptedException e) {
}
+ return mySling;
}
- protected void initArtifactDefinitions(Properties dependencies) {
- if (jarWebSupport == null) {
- jarWebSupport = new ArtifactDefinition();
- }
- jarWebSupport.initDefaults(dependencies.getProperty("jarWebSupport"));
- }
-
- /**
- * Add the JAR Web Support bundle to the bundle list.
- */
- @Override
- protected void initBundleList(BundleList bundleList) {
- bundleList.add(jarWebSupport.toBundle());
- }
}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
new file mode 100644
index 0000000..7be272a
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StartMojo.java
@@ -0,0 +1,62 @@
+/*
+ * 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.util.Map;
+
+import org.apache.felix.framework.Logger;
+import org.apache.sling.launchpad.base.impl.ResourceProvider;
+import org.apache.sling.launchpad.base.impl.Sling;
+import org.osgi.framework.BundleException;
+
+/**
+ * Start a Launchpad application.
+ *
+ * @goal start
+ * @requiresDependencyResolution test
+ *
+ */
+public class StartMojo extends AbstractLaunchpadStartingPlugin {
+
+ /**
+ * @parameter expression="${sling.control.port}" default-value="63000"
+ */
+ private int controlPort;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Sling startSling(ResourceProvider resourceProvider, final Map<String, String> props, Logger logger)
+ throws BundleException {
+ new ControlListener(this, getLog(), null, controlPort).listen();
+
+ return new Sling(this, logger, resourceProvider, props) {
+
+ // overwrite the loadPropertiesOverride method to inject the
+ // mojo arguments unconditionally. These will not be persisted
+ // in any properties file, though
+ protected void loadPropertiesOverride(
+ Map<String, String> properties) {
+ if (props != null) {
+ properties.putAll(props);
+ }
+ }
+ };
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java
new file mode 100644
index 0000000..95388e5
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StatusMojo.java
@@ -0,0 +1,49 @@
+/*
+ * 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.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Gets the status a running Launchpad standalone application.
+ *
+ * @goal status
+ * @requiresProject false
+ *
+ */
+public class StatusMojo extends AbstractMojo {
+
+ /**
+ * @parameter expression="${sling.control.port}" default-value="63000"
+ */
+ private int controlPort;
+
+ /**
+ * @parameter expression="${sling.control.host}" default-value="localhost"
+ */
+ private String controlHost;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ new ControlListener(null, getLog(), controlHost, controlPort).statusServer();
+ }
+
+}
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java
new file mode 100644
index 0000000..8fe3a8f
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/StopMojo.java
@@ -0,0 +1,49 @@
+/*
+ * 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.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * Stop a running Launchpad standalone application.
+ *
+ * @goal stop
+ * @requiresProject false
+ *
+ */
+public class StopMojo extends AbstractMojo {
+
+ /**
+ * @parameter expression="${sling.control.port}" default-value="63000"
+ */
+ private int controlPort;
+
+ /**
+ * @parameter expression="${sling.control.host}" default-value="localhost"
+ */
+ private String controlHost;
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ new ControlListener(null, getLog(), controlHost, controlPort).shutdownServer();
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 39/49: SLING-1843 - adding
launchpad:display-bundle-updates goal
Posted by ro...@apache.org.
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 3106d97328039f5660fcc2acd8bfed0c1c13f39a
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Oct 20 20:39:54 2010 +0000
SLING-1843 - adding launchpad:display-bundle-updates goal
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@1025711 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 5 +
.../projectsupport/DisplayBundleUpdatesMojo.java | 272 +++++++++++++++++++++
2 files changed, 277 insertions(+)
diff --git a/pom.xml b/pom.xml
index c32b3e5..52faf92 100644
--- a/pom.xml
+++ b/pom.xml
@@ -161,6 +161,11 @@
<artifactId>drools-compiler</artifactId>
<version>5.1.1</version>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>versions-maven-plugin</artifactId>
+ <version>1.2</version>
+ </dependency>
</dependencies>
<repositories>
diff --git a/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java b/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java
new file mode 100644
index 0000000..aa34a78
--- /dev/null
+++ b/src/main/java/org/apache/sling/maven/projectsupport/DisplayBundleUpdatesMojo.java
@@ -0,0 +1,272 @@
+/*
+ * 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.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.manager.WagonManager;
+import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
+import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.path.PathTranslator;
+import org.apache.maven.settings.Settings;
+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.mojo.versions.api.ArtifactVersions;
+import org.codehaus.mojo.versions.api.DefaultVersionsHelper;
+import org.codehaus.mojo.versions.api.UpdateScope;
+import org.codehaus.mojo.versions.api.VersionsHelper;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+/**
+ * Displays all bundles that have newer versions available. Highly based upon the
+ * display-dependency-updates goal from the Versions plugin.
+ *
+ * @since 2.0.8
+ * @goal display-bundle-updates
+ *
+ */
+public class DisplayBundleUpdatesMojo extends AbstractMojo {
+
+ /**
+ * The width to pad info messages.
+ */
+ private static final int INFO_PAD_SIZE = 72;
+
+ /**
+ * @component
+ */
+ private org.apache.maven.artifact.factory.ArtifactFactory artifactFactory;
+
+ /**
+ * @component
+ */
+ private org.apache.maven.artifact.resolver.ArtifactResolver resolver;
+
+ /**
+ * @component
+ */
+ private MavenProjectBuilder projectBuilder;
+
+ /**
+ * @parameter expression="${reactorProjects}"
+ * @required
+ * @readonly
+ */
+ private List reactorProjects;
+
+ /**
+ * The artifact metadata source to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private ArtifactMetadataSource artifactMetadataSource;
+
+ /**
+ * @parameter expression="${project.remoteArtifactRepositories}"
+ * @readonly
+ */
+ private List remoteArtifactRepositories;
+
+ /**
+ * @parameter expression="${project.pluginArtifactRepositories}"
+ * @readonly
+ */
+ private List remotePluginRepositories;
+
+ /**
+ * @parameter expression="${localRepository}"
+ * @readonly
+ */
+ private ArtifactRepository localRepository;
+
+ /**
+ * @component
+ */
+ private WagonManager wagonManager;
+
+ /**
+ * @parameter expression="${settings}"
+ * @readonly
+ */
+ private Settings settings;
+
+ /**
+ * settings.xml's server id for the URL. This is used when wagon needs extra
+ * authentication information.
+ *
+ * @parameter expression="${maven.version.rules.serverId}"
+ * default-value="serverId";
+ */
+ private String serverId;
+
+ /**
+ * The Wagon URI of a ruleSet file containing the rules that control how to
+ * compare version numbers.
+ *
+ * @parameter expression="${maven.version.rules}"
+ */
+ private String rulesUri;
+
+ /**
+ * The Maven Session.
+ *
+ * @parameter expression="${session}"
+ * @required
+ * @readonly
+ */
+ private MavenSession session;
+
+ /**
+ * @component
+ */
+ private PathTranslator pathTranslator;
+
+ /**
+ * @parameter default-value="${basedir}/src/main/bundles/list.xml"
+ */
+ private File bundleListFile;
+
+ /**
+ * Whether to allow snapshots when searching for the latest version of an
+ * artifact.
+ *
+ * @parameter expression="${allowSnapshots}" default-value="false"
+ */
+ private boolean allowSnapshots;
+
+ /**
+ * Our versions helper.
+ */
+ private VersionsHelper helper;
+
+ @SuppressWarnings("unchecked")
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ try {
+ BundleList bundleList = readBundleList(bundleListFile);
+
+ Set<Dependency> bundlesAsDependencies = new HashSet<Dependency>();
+
+ for (StartLevel startLevel : bundleList.getStartLevels()) {
+ for (Bundle bundle : startLevel.getBundles()) {
+ bundlesAsDependencies.add(asDependency(bundle));
+ }
+ }
+
+ logUpdates(getHelper().lookupDependenciesUpdates(bundlesAsDependencies, false));
+ } catch (Exception e) {
+ throw new MojoExecutionException("Unable to read bundle list.", e);
+ }
+
+ }
+
+ private Dependency asDependency(Bundle bundle) {
+ Dependency dep = new Dependency();
+ dep.setGroupId(bundle.getGroupId());
+ dep.setArtifactId(bundle.getArtifactId());
+ dep.setClassifier(bundle.getClassifier());
+ dep.setVersion(bundle.getVersion());
+ dep.setType(bundle.getType());
+
+ return dep;
+ }
+
+ private VersionsHelper getHelper() throws MojoExecutionException {
+ if (helper == null) {
+ helper = new DefaultVersionsHelper(artifactFactory, artifactMetadataSource, remoteArtifactRepositories,
+ remotePluginRepositories, localRepository, wagonManager, settings, serverId, rulesUri, getLog(),
+ session, pathTranslator);
+ }
+ return helper;
+ }
+
+ private void logUpdates(Map<Dependency, ArtifactVersions> updates) {
+ List<String> withUpdates = new ArrayList<String>();
+ List<String> usingCurrent = new ArrayList<String>();
+ for (ArtifactVersions versions : updates.values()) {
+ String left = " " + ArtifactUtils.versionlessKey(versions.getArtifact()) + " ";
+ final String current = versions.isCurrentVersionDefined() ? versions.getCurrentVersion().toString()
+ : versions.getArtifact().getVersionRange().toString();
+ ArtifactVersion latest = versions.getNewestUpdate(UpdateScope.ANY, Boolean.TRUE.equals(allowSnapshots));
+ if (latest != null && !versions.isCurrentVersionDefined()) {
+ if (versions.getArtifact().getVersionRange().containsVersion(latest)) {
+ latest = null;
+ }
+ }
+ String right = " " + (latest == null ? current : current + " -> " + latest.toString());
+ List<String> t = latest == null ? usingCurrent : withUpdates;
+ if (right.length() + left.length() + 3 > INFO_PAD_SIZE) {
+ t.add(left + "...");
+ t.add(StringUtils.leftPad(right, INFO_PAD_SIZE));
+
+ } else {
+ t.add(StringUtils.rightPad(left, INFO_PAD_SIZE - right.length(), ".") + right);
+ }
+ }
+
+ if (usingCurrent.isEmpty() && !withUpdates.isEmpty()) {
+ getLog().info("No bundles are using the newest version.");
+ getLog().info("");
+ } else if (!usingCurrent.isEmpty()) {
+ getLog().info("The following bundles are using the newest version:");
+ for (String str : usingCurrent) {
+ getLog().info(str);
+ }
+ getLog().info("");
+ }
+ if (withUpdates.isEmpty() && !usingCurrent.isEmpty()) {
+ getLog().info("No bundles have newer versions.");
+ getLog().info("");
+ } else if (!withUpdates.isEmpty()) {
+ getLog().info("The following bundles have newer versions:");
+ for (String str : withUpdates) {
+ getLog().info(str);
+ }
+ getLog().info("");
+ }
+ }
+
+ private BundleList readBundleList(File file) throws IOException, XmlPullParserException {
+ BundleListXpp3Reader reader = new BundleListXpp3Reader();
+ FileInputStream fis = new FileInputStream(file);
+ try {
+ return reader.read(fis);
+ } finally {
+ fis.close();
+ }
+ }
+
+}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.
[sling-maven-launchpad-plugin] 14/49: fix formatting of pom file
Posted by ro...@apache.org.
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 99ee468a4bca22f051a7cb167228239d860b8e86
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Fri Apr 16 14:53:06 2010 +0000
fix formatting of pom file
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/maven/maven-launchpad-plugin@934946 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pom.xml b/pom.xml
index 2b88de5..afb1f58 100644
--- a/pom.xml
+++ b/pom.xml
@@ -133,9 +133,9 @@
<version>2.1.1-SNAPSHOT</version>
</dependency>
<dependency>
- <groupId>org.apache.sling</groupId>
- <artifactId>org.apache.sling.launchpad.base</artifactId>
- <version>2.1.1-SNAPSHOT</version>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.launchpad.base</artifactId>
+ <version>2.1.1-SNAPSHOT</version>
<classifier>app</classifier>
</dependency>
<dependency>
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.