You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ca...@apache.org on 2007/02/23 02:12:57 UTC

svn commit: r510745 - /maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java

Author: carlos
Date: Thu Feb 22 17:12:56 2007
New Revision: 510745

URL: http://svn.apache.org/viewvc?view=rev&rev=510745
Log:
Add instructions from pom config and set manifest default location to target/classes/META-INF

Modified:
    maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java

Modified: maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java?view=diff&rev=510745&r1=510744&r2=510745
==============================================================================
--- maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java (original)
+++ maven/sandbox/trunk/plugins/maven-bundle-plugin/src/main/java/org/apache/felix/tools/maven2/bundleplugin/ManifestPlugin.java Thu Feb 22 17:12:56 2007
@@ -44,10 +44,9 @@
 
     /**
      * Directory where the manifest will be written
-     * @parameter
-     * @default ""
+     * @parameter expression="${project.build.outputDirectory}/META-INF"
      */
-    private String manifestLocation = "";
+    private String manifestLocation;
 
     protected void execute( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
         throws MojoExecutionException
@@ -55,14 +54,14 @@
         Manifest manifest;
         try
         {
-            manifest = getManifest( project, properties, classpath );
+            manifest = getManifest( project, instructions, properties, classpath );
         }
         catch ( IOException e )
         {
             throw new MojoExecutionException( "Error trying to generate Manifest", e );
         }
 
-        File outputFile = new File( getBuildDirectory(), manifestLocation + "/MANIFEST.MF" );
+        File outputFile = new File( manifestLocation + "/MANIFEST.MF" );
 
         try
         {
@@ -77,22 +76,22 @@
     public Manifest getManifest( MavenProject project, Jar[] classpath )
         throws IOException
     {
-        return getManifest( project, null, classpath );
+        return getManifest( project, null, null, classpath );
     }
 
-    public Manifest getManifest( MavenProject project, Properties properties, Jar[] classpath )
+    public Manifest getManifest( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
         throws IOException
     {
-        return getAnalyzer( project, properties, classpath ).getJar().getManifest();
+        return getAnalyzer( project, instructions, properties, classpath ).getJar().getManifest();
     }
 
     protected Analyzer getAnalyzer( MavenProject project, Jar[] classpath )
         throws IOException
     {
-        return getAnalyzer( project, null, classpath );
+        return getAnalyzer( project, null, null, classpath );
     }
 
-    protected Analyzer getAnalyzer( MavenProject project, Properties properties, Jar[] classpath )
+    protected Analyzer getAnalyzer( MavenProject project, Map instructions, Properties properties, Jar[] classpath )
         throws IOException
     {
         PackageVersionAnalyzer analyzer = new PackageVersionAnalyzer();
@@ -103,15 +102,20 @@
             analyzer.getProperties().putAll( properties );
         }
 
+        analyzer.getProperties().putAll( instructions );
+
         analyzer.setJar( project.getArtifact().getFile() );
 
         if ( analyzer.getProperty( Analyzer.IMPORT_PACKAGE ) == null )
             analyzer.setProperty( Analyzer.IMPORT_PACKAGE, "*" );
 
-        if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null )
+        if ( !instructions.containsKey( Analyzer.PRIVATE_PACKAGE ) )
         {
-            String export = analyzer.calculateExportsFromContents( analyzer.getJar() );
-            analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
+            if ( analyzer.getProperty( Analyzer.EXPORT_PACKAGE ) == null )
+            {
+                String export = analyzer.calculateExportsFromContents( analyzer.getJar() );
+                analyzer.setProperty( Analyzer.EXPORT_PACKAGE, export );
+            }
         }
 
         if ( classpath != null )