You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ju...@apache.org on 2011/05/06 20:26:24 UTC
svn commit: r1100313 - in
/sling/trunk/maven/maven-sling-plugin/src/main/java/org/apache/sling/maven/bundlesupport:
AbstractBundleDeployMojo.java AbstractBundleInstallMojo.java
AbstractBundlePostMojo.java
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
* <code>jarFile</code> does not contain a manifest with a
* <code>Bundle-SymbolicName</code> header <code>null</code> is