maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1190498 - in /maven/plugins/trunk/maven-antrun-plugin/src: it/never-fail-test/ it/never-fail-test/invoker.properties it/never-fail-test/pom.xml main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
Date Fri, 28 Oct 2011 18:53:41 GMT
Author: bimargulies
Date: Fri Oct 28 18:53:41 2011
New Revision: 1190498

URL: http://svn.apache.org/viewvc?rev=1190498&view=rev
Log:
MANTRUN-170: Allow antrun to avoid failing the build

o added neverFail parameter.

Added:
    maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/
    maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties   (with
props)
    maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml   (with props)
Modified:
    maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java

Added: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties?rev=1190498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties (added)
+++ maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties Fri
Oct 28 18:53:41 2011
@@ -0,0 +1 @@
+invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:run

Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/invoker.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml?rev=1190498&view=auto
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml (added)
+++ maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml Fri Oct 28 18:53:41
2011
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>antrun-plugin.test</groupId>
+  <artifactId>antrun-plugin-never-fail-test</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <inceptionYear>2011</inceptionYear>
+  <name>Never Fail test for Antrun</name>
+  <url>http://maven.apache.org</url>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+	  <neverFail>true</neverFail>
+          <tasks>
+	    <fail>This is a failure</fail>
+          </tasks>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-antrun-plugin/src/it/never-fail-test/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java?rev=1190498&r1=1190497&r2=1190498&view=diff
==============================================================================
--- maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
(original)
+++ maven/plugins/trunk/maven-antrun-plugin/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java
Fri Oct 28 18:53:41 2011
@@ -214,6 +214,17 @@ public class AntRunMojo
      * @since 1.7
      */
     private boolean exportAntProperties;
+    
+    /**
+     * Specifies whether a failure in the ant build leads to a failure of the Maven build.
+     * 
+     * If this value is 'true', the Maven build will proceed even if the ant build fails.
+     * If it is 'false', then the Maven build fails if the ant build fails.
+     * 
+     * @parameter default-value="false"
+     * @since 1.7
+     */
+    private boolean neverFail;
 
     /**
      * @see org.apache.maven.plugin.Mojo#execute()
@@ -335,7 +346,14 @@ public class AntRunMojo
             {
                 sb.append( "\n" ).append( fragment );
             }
-            throw new MojoExecutionException( sb.toString(), e );
+            if ( neverFail) 
+            {
+                getLog().info( sb.toString(), e );
+                return; // do not register roots.
+            } else 
+            {
+                throw new MojoExecutionException( sb.toString(), e );
+            }
         }
         catch ( Throwable e )
         {



Mime
View raw message