net.sourceforge.cruisecontrol.builders
Class Maven2Script

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.builders.Maven2Script
All Implemented Interfaces:
Script, StreamConsumer

public class Maven2Script
extends java.lang.Object
implements Script, StreamConsumer

Maven2 script class based on the Maven builder class from Eric Pugh.
Contains all the details related to running a Maven based build.

Author:
Steria Benelux Sa/Nv - Provided without any warranty

Constructor Summary
Maven2Script(org.jdom.Element buildLogElement, java.lang.String mvn, java.lang.String pomFile, java.lang.String goals, java.lang.String settingsFile, java.lang.String activateProfiles, java.lang.String flags)
           
 
Method Summary
 Commandline buildCommandline()
          Construct the command that we're going to execute.
 void consumeLine(java.lang.String line)
          Analyze the output of the mvn command.
protected  void flushCurrentElement()
           
 int getExitCode()
           
 void setBuildProperties(java.util.Map buildProperties)
           
 void setExitCode(int exitCode)
          exitCode is what is returned from running the script
 void setGoalset(java.lang.String goalset)
           
 void setMvnScript(java.lang.String mvnScript)
           
 void setPomFile(java.lang.String pomFile)
           
 void setProperties(java.util.List properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Maven2Script

public Maven2Script(org.jdom.Element buildLogElement,
                    java.lang.String mvn,
                    java.lang.String pomFile,
                    java.lang.String goals,
                    java.lang.String settingsFile,
                    java.lang.String activateProfiles,
                    java.lang.String flags)
Parameters:
buildLogElement - Log to store result of the execution for CC
mvn - path to the mvn script
pomFile - path to the pom file
goals - the goalset to execute
settingsFile - path to the settings file (not required)
activateProfiles - comma-delimited list of profiles to activate. (not required)
flags - extra parameter to pass to mvn e.g.: -U (not required)
Method Detail

buildCommandline

public Commandline buildCommandline()
                             throws CruiseControlException
Construct the command that we're going to execute.

Specified by:
buildCommandline in interface Script
Returns:
Commandline holding command to be executed
Throws:
CruiseControlException

consumeLine

public void consumeLine(java.lang.String line)
Analyze the output of the mvn command. This is used to detect errors or successful build.

Specified by:
consumeLine in interface StreamConsumer

flushCurrentElement

protected void flushCurrentElement()

setBuildProperties

public void setBuildProperties(java.util.Map buildProperties)
Parameters:
buildProperties - The buildProperties to set.

setGoalset

public void setGoalset(java.lang.String goalset)
Parameters:
goalset - The goalset to set.

setMvnScript

public void setMvnScript(java.lang.String mvnScript)
Parameters:
mvnScript - The mavenScript to set.

setPomFile

public void setPomFile(java.lang.String pomFile)
Parameters:
pomFile - The projectFile to set.

setProperties

public void setProperties(java.util.List properties)
Parameters:
properties - The properties to set.

getExitCode

public int getExitCode()
Specified by:
getExitCode in interface Script
Returns:
the exitCode.

setExitCode

public void setExitCode(int exitCode)
Description copied from interface: Script
exitCode is what is returned from running the script

Specified by:
setExitCode in interface Script
Parameters:
exitCode - The exitCode to set.