geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Dillon <ja...@planet57.com>
Subject Re: svn commit: r487604 - in /geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/geronimo: module/ModuleMojoSupport.java reporting/ReportingMojoSupport.java
Date Fri, 15 Dec 2006 19:52:53 GMT
Please be sure to keep the site docs updated when you add/remove  
features from the plugin.

--jason


On Dec 15, 2006, at 9:41 AM, prasad@apache.org wrote:

> Author: prasad
> Date: Fri Dec 15 09:41:09 2006
> New Revision: 487604
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=487604
> Log:
> * a failed deployment would stop the tests for everybody.
> * stopOnFailure config option will now let the tests proceed even  
> if one bad deployment took place.
>
> Modified:
>     geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/module/ 
> ModuleMojoSupport.java
>     geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/reporting/ 
> ReportingMojoSupport.java
>
> Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/ 
> src/main/java/org/apache/geronimo/mavenplugins/geronimo/module/ 
> ModuleMojoSupport.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven- 
> plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/ 
> mavenplugins/geronimo/module/ModuleMojoSupport.java? 
> view=diff&rev=487604&r1=487603&r2=487604
> ====================================================================== 
> ========
> --- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/module/ 
> ModuleMojoSupport.java (original)
> +++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/module/ 
> ModuleMojoSupport.java Fri Dec 15 09:41:09 2006
> @@ -64,6 +64,15 @@
>       */
>      private DeploymentManager deploymentManager;
>
> +
> +    /**
> +     * Whether to stop or proceed when errors and failures are  
> encountered
> +     *
> +     * @parameter expression="${stopOnFailure}" default-value="false"
> +     */
> +    protected boolean stopOnFailure = false;
> +
> +
>      /**
>       * Get a deployment manager; if the manager was previosuly  
> initialized then that cached instance is used.
>       *
>
> Modified: geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/ 
> src/main/java/org/apache/geronimo/mavenplugins/geronimo/reporting/ 
> ReportingMojoSupport.java
> URL: http://svn.apache.org/viewvc/geronimo/server/trunk/maven- 
> plugins/geronimo-maven-plugin/src/main/java/org/apache/geronimo/ 
> mavenplugins/geronimo/reporting/ReportingMojoSupport.java? 
> view=diff&rev=487604&r1=487603&r2=487604
> ====================================================================== 
> ========
> --- geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/reporting/ 
> ReportingMojoSupport.java (original)
> +++ geronimo/server/trunk/maven-plugins/geronimo-maven-plugin/src/ 
> main/java/org/apache/geronimo/mavenplugins/geronimo/reporting/ 
> ReportingMojoSupport.java Fri Dec 15 09:41:09 2006
> @@ -34,8 +34,7 @@
>   * @version $Rev$ $Date$
>   */
>  public abstract class ReportingMojoSupport
> -    extends GeronimoMojoSupport
> -{
> +extends GeronimoMojoSupport {
>      /**
>       * Enable logging mode.
>       *
> @@ -69,6 +68,16 @@
>       */
>      protected Reporter[] reporters = null;
>
> +
> +    /**
> +     * Whether to stop or proceed when errors and failures are  
> encountered
> +     *
> +     * @parameter expression="${stopOnFailure}" default-value="true"
> +     */
> +    protected boolean stopOnFailure;
> +
> +
> +
>      /**
>       * Provides hooks into the reporting interface to allow for  
> customized reports to be generated
>       * for goal executions.
> @@ -76,33 +85,38 @@
>      public void execute() throws MojoExecutionException,  
> MojoFailureException {
>          init();
>
> -        if (log.isDebugEnabled()) {
> -            if (reporters != null) {
> +        if ( log.isDebugEnabled() ) {
> +            if ( reporters != null ) {
>                  log.debug("Reporters: " + Arrays.asList(reporters));
>              }
>              else {
>                  log.debug("No reporters configured");
>              }
>          }
> -
> +
>          reportBegin();
>
>          try {
>              doExecute();
>          }
> -        catch(Exception e) {
> +        catch ( Exception e ) {
>              reportError(e);
>
> -            if (e instanceof MojoExecutionException) {
> -                throw new MojoExecutionException(e.getMessage(), e);
> -            }
> -            else if (e instanceof MojoFailureException) {
> -                MojoFailureException x = new MojoFailureException 
> (e.getMessage());
> -                x.initCause(e);
> -                throw x;
> +            if ( stopOnFailure ) {
> +                if ( e instanceof MojoExecutionException ) {
> +                    throw new MojoExecutionException(e.getMessage 
> (), e);
> +                }
> +                else if ( e instanceof MojoFailureException ) {
> +                    MojoFailureException x = new  
> MojoFailureException(e.getMessage());
> +                    x.initCause(e);
> +                    throw x;
> +                }
> +                else {
> +                    throw new MojoExecutionException(e.getMessage 
> (), e);
> +                }
>              }
>              else {
> -                throw new MojoExecutionException(e.getMessage(), e);
> +                log.warn("Ignoring failure !");
>              }
>          }
>          finally {
> @@ -111,7 +125,7 @@
>      }
>
>      protected File getLogFile() {
> -        if (logFile == null) {
> +        if ( logFile == null ) {
>              return new File(logOutputDirectory, getFullClassName()  
> + ".log");
>          }
>
> @@ -130,7 +144,7 @@
>      //
>
>      private void reportBegin() {
> -        if (reporters == null) {
> +        if ( reporters == null ) {
>              return;
>          }
>
> @@ -150,29 +164,29 @@
>              }
>          };
>
> -        for (int i =0; i < reporters.length; i++) {
> +        for ( int i =0; i < reporters.length; i++ ) {
>              reporters[i].reportBegin(source);
>          }
>      }
> -
> +
>      private void reportError(final Throwable cause) {
>          assert cause != null;
>
> -        if (reporters == null) {
> +        if ( reporters == null ) {
>              return;
>          }
>
> -        for (int i=0; i < reporters.length; i++) {
> +        for ( int i=0; i < reporters.length; i++ ) {
>              reporters[i].reportError(cause);
>          }
>      }
>
>      private void reportEnd() {
> -        if (reporters == null) {
> +        if ( reporters == null ) {
>              return;
>          }
>
> -        for (int i=0; i < reporters.length; i++) {
> +        for ( int i=0; i < reporters.length; i++ ) {
>              reporters[i].reportEnd();
>          }
>      }
>
>


Mime
View raw message