Author: mcculls
Date: Fri Dec 7 00:22:20 2007
New Revision: 602019
URL: http://svn.apache.org/viewvc?rev=602019&view=rev
Log:
FELIX-433: add unpackBundle option that unpacks the bundle contents to the Maven output directory
Modified:
felix/trunk/bundleplugin/pom.xml
felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Modified: felix/trunk/bundleplugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/pom.xml?rev=602019&r1=602018&r2=602019&view=diff
==============================================================================
--- felix/trunk/bundleplugin/pom.xml (original)
+++ felix/trunk/bundleplugin/pom.xml Fri Dec 7 00:22:20 2007
@@ -89,6 +89,16 @@
<version>1.0-alpha-9-stable-1</version>
</dependency>
<dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-archiver</artifactId>
+ <version>1.0-alpha-7</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.4.1</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>1.1</version>
Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=602019&r1=602018&r2=602019&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Fri Dec 7 00:22:20 2007
@@ -43,6 +43,8 @@
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.osgi.Maven2OsgiConverter;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.util.DirectoryScanner;
import aQute.lib.osgi.Analyzer;
@@ -69,6 +71,18 @@
protected File manifestLocation;
/**
+ * When true, unpack the bundle contents to the outputDirectory
+ *
+ * @parameter expression="${unpackBundle}"
+ */
+ protected boolean unpackBundle;
+
+ /**
+ * @component
+ */
+ private ArchiverManager archiverManager;
+
+ /**
* @component
*/
private ArtifactHandlerManager artifactHandlerManager;
@@ -307,6 +321,21 @@
builder.getJar().write(jarFile);
Artifact bundleArtifact = project.getArtifact();
bundleArtifact.setFile(jarFile);
+
+ if (unpackBundle)
+ {
+ try
+ {
+ UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
+ unArchiver.setDestDirectory( getOutputDirectory() );
+ unArchiver.setSourceFile( jarFile );
+ unArchiver.extract();
+ }
+ catch ( Exception e )
+ {
+ getLog().error( "Problem unpacking " + jarFile + " to " + getOutputDirectory(),
e );
+ }
+ }
if (manifestLocation != null)
{
|