You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2007/09/11 09:48:10 UTC

svn commit: r574500 - in /felix/trunk/bundleplugin/src: main/java/org/apache/felix/bundleplugin/ManifestPlugin.java test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java

Author: mcculls
Date: Tue Sep 11 00:48:10 2007
New Revision: 574500

URL: http://svn.apache.org/viewvc?rev=574500&view=rev
Log:
FELIX-352: provide informational error message when manifest goal is run before compile phase

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
    felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java?rev=574500&r1=574499&r2=574500&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/ManifestPlugin.java Tue Sep 11 00:48:10 2007
@@ -19,6 +19,7 @@
 package org.apache.felix.bundleplugin;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
@@ -57,6 +58,10 @@
         {
             manifest = this.getManifest( project, instructions, properties, classpath );
         }
+        catch ( FileNotFoundException e )
+        {
+            throw new MojoExecutionException( "Cannot find " + e.getMessage() + " (manifest goal must be run after compile phase)", e );
+        }
         catch ( IOException e )
         {
             throw new MojoExecutionException( "Error trying to generate Manifest", e );
@@ -112,16 +117,15 @@
         File file = project.getArtifact().getFile();
         if ( file == null )
         {
-            analyzer.setJar( this.getOutputDirectory() );
+            file = getOutputDirectory();
         }
-        else
+
+        if ( !file.exists() )
         {
-            if ( !file.exists() )
-            {
-                file.mkdirs();
-            }
-            analyzer.setJar( project.getArtifact().getFile() );
+            throw new FileNotFoundException( file.getPath() );
         }
+
+        analyzer.setJar( file );
 
         if ( classpath != null )
             analyzer.setClasspath( classpath );

Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java?rev=574500&r1=574499&r2=574500&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundleAllPluginTest.java Tue Sep 11 00:48:10 2007
@@ -24,7 +24,6 @@
 import java.util.Collections;
 import java.util.Map;
 
-import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;