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/21 17:07:37 UTC

svn commit: r578159 - /felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

Author: mcculls
Date: Fri Sep 21 08:07:36 2007
New Revision: 578159

URL: http://svn.apache.org/viewvc?rev=578159&view=rev
Log:
FELIX-377: support -failok directive

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java

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=578159&r1=578158&r2=578159&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 Sep 21 08:07:36 2007
@@ -265,47 +265,50 @@
             List errors = builder.getErrors();
             List warnings = builder.getWarnings();
 
-            if (errors.size() > 0)
+            for (Iterator w = warnings.iterator(); w.hasNext();)
             {
-                jarFile.delete();
-                for (Iterator e = errors.iterator(); e.hasNext();)
-                {
-                     String msg = (String) e.next();
-                     this.getLog().error("Error building bundle " + project.getArtifact() + " : " + msg);
-                }
-                throw new MojoFailureException("Found errors, see log");
+                String msg = (String) w.next();
+                this.getLog().warn("Warning building bundle " + project.getArtifact() + " : " + msg);
             }
-            else
+            for (Iterator e = errors.iterator(); e.hasNext();)
             {
-                jarFile.getParentFile().mkdirs();
-                builder.getJar().write(jarFile);
-                Artifact bundleArtifact = project.getArtifact();
-                bundleArtifact.setFile(jarFile);
+                 String msg = (String) e.next();
+                 this.getLog().error("Error building bundle " + project.getArtifact() + " : " + msg);
+            }
 
-                if (manifestLocation != null && manifestLocation.length() > 0)
+            if (errors.size() > 0)
+            {
+                String failok = properties.getProperty( "-failok" );
+                if (null == failok || "false".equalsIgnoreCase( failok ))
                 {
-                    File outputFile = new File( manifestLocation, "MANIFEST.MF" );
+                    jarFile.delete();
 
-                    try
-                    {
-                        Manifest manifest = builder.getJar().getManifest();
-                        ManifestPlugin.writeManifest( manifest, outputFile );
-                    }
-                    catch ( IOException e )
-                    {
-                        getLog().error( "Error trying to write Manifest to file " + outputFile, e );
-                    }
+                    throw new MojoFailureException("Found errors, see log");
                 }
-                
-                // workaround for MNG-1682: force maven to install artifact using the "jar" handler
-                bundleArtifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "jar" ) );
             }
 
-            for (Iterator w = warnings.iterator(); w.hasNext();)
+            jarFile.getParentFile().mkdirs();
+            builder.getJar().write(jarFile);
+            Artifact bundleArtifact = project.getArtifact();
+            bundleArtifact.setFile(jarFile);
+
+            if (manifestLocation != null && manifestLocation.length() > 0)
             {
-                String msg = (String) w.next();
-                this.getLog().warn("Warning building bundle " + project.getArtifact() + " : " + msg);
+                File outputFile = new File( manifestLocation, "MANIFEST.MF" );
+
+                try
+                {
+                    Manifest manifest = builder.getJar().getManifest();
+                    ManifestPlugin.writeManifest( manifest, outputFile );
+                }
+                catch ( IOException e )
+                {
+                    getLog().error( "Error trying to write Manifest to file " + outputFile, e );
+                }
             }
+            
+            // workaround for MNG-1682: force maven to install artifact using the "jar" handler
+            bundleArtifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "jar" ) );
         }
         catch (Exception e)
         {