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:48 UTC
[sling-maven-launchpad-plugin] 05/49: SLING-1323 - adding
"bundlesToRemove" option
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>.