Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A2E0E3EA2 for ; Fri, 6 May 2011 18:26:45 +0000 (UTC) Received: (qmail 97066 invoked by uid 500); 6 May 2011 18:26:45 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 97025 invoked by uid 500); 6 May 2011 18:26:45 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 97018 invoked by uid 99); 6 May 2011 18:26:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 18:26:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 May 2011 18:26:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3AB0223889ED; Fri, 6 May 2011 18:26:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1100313 - in /sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport: AbstractBundleDeployMojo.java AbstractBundleInstallMojo.java AbstractBundlePostMojo.java Date: Fri, 06 May 2011 18:26:24 -0000 To: commits@sling.apache.org From: justin@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110506182624.3AB0223889ED@eris.apache.org> Author: justin Date: Fri May 6 18:26:23 2011 New Revision: 1100313 URL: http://svn.apache.org/viewvc?rev=1100313&view=rev Log: SLING-2075 - adding failOnError option to install, install-file, deploy and deploy-file goals Modified: sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java Modified: sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java?rev=1100313&r1=1100312&r2=1100313&view=diff ============================================================================== --- sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java (original) +++ sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleDeployMojo.java Fri May 6 18:26:23 2011 @@ -114,9 +114,13 @@ abstract class AbstractBundleDeployMojo if (status == HttpStatus.SC_OK) { getLog().info("Bundle deployed"); } else { - this.getLog().error( - "Deployment failed, cause: " - + HttpStatus.getStatusText(status)); + String msg = "Deployment failed, cause: " + + HttpStatus.getStatusText(status); + if (failOnError) { + throw new MojoExecutionException(msg); + } else { + getLog().error(msg); + } } } catch (Exception ex) { throw new MojoExecutionException("Deployment on " + targetURL Modified: sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java?rev=1100313&r1=1100312&r2=1100313&view=diff ============================================================================== --- sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java (original) +++ sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundleInstallMojo.java Fri May 6 18:26:23 2011 @@ -278,9 +278,13 @@ abstract class AbstractBundleInstallMojo if (status == HttpStatus.SC_OK) { getLog().info("Bundle installed"); } else { - getLog().error( - "Installation failed, cause: " - + HttpStatus.getStatusText(status)); + String msg = "Installation failed, cause: " + + HttpStatus.getStatusText(status); + if (failOnError) { + throw new MojoExecutionException(msg); + } else { + getLog().error(msg); + } } } catch (Exception ex) { throw new MojoExecutionException("Installation on " + targetURL @@ -301,9 +305,13 @@ abstract class AbstractBundleInstallMojo if (status >= 200 && status < 300) { getLog().info("Bundle installed"); } else { - getLog().error( - "Installation failed, cause: " - + HttpStatus.getStatusText(status)); + String msg = "Installation failed, cause: " + + HttpStatus.getStatusText(status); + if (failOnError) { + throw new MojoExecutionException(msg); + } else { + getLog().error(msg); + } } } catch (Exception ex) { throw new MojoExecutionException("Installation on " + targetURL Modified: sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java URL: http://svn.apache.org/viewvc/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java?rev=1100313&r1=1100312&r2=1100313&view=diff ============================================================================== --- sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java (original) +++ sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport/AbstractBundlePostMojo.java Fri May 6 18:26:23 2011 @@ -28,6 +28,15 @@ import org.apache.maven.plugin.AbstractM abstract class AbstractBundlePostMojo extends AbstractMojo { /** + * Determines whether or not to fail the build if + * the HTTP POST or PUT returns an non-OK response code. + * + * @parameter expression="${sling.failOnError}" default-value="false" + * @required + */ + protected boolean failOnError; + + /** * Returns the symbolic name of the given bundle. If the * jarFile does not contain a manifest with a * Bundle-SymbolicName header null is