Applied patch (FELIX-305) to allow the output folder to be configured.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@547231 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
index d9ae31b..eeb4a44 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundleAllPlugin.java
@@ -52,6 +52,7 @@
 import aQute.lib.osgi.Jar;
 
 /**
+ * Create OSGi bundles from all dependencies in the Maven project
  * 
  * @goal bundleall
  * @phase package
@@ -282,7 +283,7 @@
                 osgiJar.setManifest( manifest );
             }
 
-            outputFile.getParentFile().mkdirs();
+            outputFile.getAbsoluteFile().getParentFile().mkdirs();
             osgiJar.write( outputFile );
 
             BundleInfo bundleInfo = addExportedPackages( project, exportedPackages );
@@ -428,7 +429,7 @@
 
     protected File getOutputFile( Artifact artifact )
     {
-        return new File( getBuildDirectory(), getBundleName( artifact ) );
+        return new File( getOutputDirectory(), getBundleName( artifact ) );
     }
 
     private Artifact resolveArtifact( Artifact artifact )
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 4f06e35..3ceb9d2 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -21,18 +21,18 @@
 import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
-import java.util.regex.*;
 import java.util.zip.ZipException;
- 
+
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.model.*;
 import org.apache.maven.plugin.*;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.osgi.Maven2OsgiConverter;
- 
+
 import aQute.lib.osgi.*;
  
 /**
+ * Create an OSGi bundle from Maven project
  * 
  * @goal bundle
  * @phase package
@@ -40,15 +40,16 @@
  * @description build an OSGi bundle jar
  */
 public class BundlePlugin extends AbstractMojo {
- 
+
  private static final Collection SUPPORTED_PROJECT_TYPES = Arrays.asList(new String[]{"jar","bundle"});
 
  /**
+  * The directory for the generated bundles.
+  * 
   * @parameter expression="${project.build.outputDirectory}"
   * @required
-  * @readonly
   */
- File     outputDirectory;
+ private File outputDirectory;
  
  /**
   * The directory for the pom
@@ -82,12 +83,19 @@
   */
  private Map    instructions = new HashMap();
 
- private Maven2OsgiConverter maven2OsgiConverter = new Maven2OsgiConverter();
+ /**
+  * @component
+  */
+ private Maven2OsgiConverter maven2OsgiConverter;
 
  protected Maven2OsgiConverter getMaven2OsgiConverter() {
   return maven2OsgiConverter;
  }
 
+ void setMaven2OsgiConverter(Maven2OsgiConverter maven2OsgiConverter) {
+  this.maven2OsgiConverter = maven2OsgiConverter;
+ }
+
  protected MavenProject getProject() {
   return project;
  }
@@ -264,8 +272,8 @@
  protected Jar[] getClasspath(MavenProject project) throws ZipException, IOException {
   List list = new ArrayList();
   
-  if (outputDirectory != null && outputDirectory.exists()) {
-    list.add(new Jar(".", outputDirectory));
+  if (getOutputDirectory() != null && getOutputDirectory().exists()) {
+    list.add(new Jar(".", getOutputDirectory()));
   }
  
   Set artifacts = project.getDependencyArtifacts();
@@ -382,7 +390,7 @@
      properties.putAll( getProperies(project.getModel(), "project.", project));
      properties.put("project.baseDir", baseDir );
      properties.put("project.build.directory", getBuildDirectory() );
-     properties.put("project.build.outputdirectory", outputDirectory );
+     properties.put("project.build.outputdirectory", getOutputDirectory() );
      
      return properties;
  }
@@ -391,6 +399,10 @@
      this.baseDir = basedir;
  }
 
+ File getOutputDirectory(){
+     return this.outputDirectory;
+ }
+
  void setOutputDirectory(File outputDirectory){
      this.outputDirectory = outputDirectory;
  }
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
index fc79766..bd76d24 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
@@ -28,6 +28,7 @@
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 
 /**
  * Test for {@link BundleAllPlugin}
@@ -57,6 +58,7 @@
         plugin.setBuildDirectory( buildDirectory.getPath() );
         File outputDirectory = new File( buildDirectory, "classes" );
         plugin.setOutputDirectory( outputDirectory );
+        plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
     }
 
     public void testSnapshotMatch()
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index 524079e..6478f10 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -28,6 +28,7 @@
 
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
 import org.codehaus.plexus.archiver.ArchiverException;
 import org.codehaus.plexus.archiver.jar.JarArchiver;
 
@@ -51,6 +52,7 @@
     {
         super.setUp();
         plugin = new BundlePlugin();
+        plugin.setMaven2OsgiConverter( new DefaultMaven2OsgiConverter() );
     }
 
     public void testConvertVersionToOsgi()