net.sourceforge.cruisecontrol.builders
Class Maven2Builder

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.util.PerDayScheduleItem
      extended bynet.sourceforge.cruisecontrol.Builder
          extended bynet.sourceforge.cruisecontrol.builders.Maven2Builder
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class Maven2Builder
extends Builder

Maven2 builder class based on the Maven builder class from Florin Vancea.
Attempts to mimic the behavior of Ant builds, at least as far as CC is concerned. Basically it's a (heavily) edited version of AntBuilder. No style at all, but serves its purpose. :)

Author:
Steria Benelux Sa/Nv - Provided without any warranty
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.cruisecontrol.util.PerDayScheduleItem
INVALID_NAME_OF_DAY, NOT_SET
 
Constructor Summary
Maven2Builder()
           
 
Method Summary
 org.jdom.Element build(java.util.Map buildProperties)
          build and return the results via xml.
 org.jdom.Element buildWithTarget(java.util.Map properties, java.lang.String target)
           
 Property createProperty()
           
protected  java.lang.String findMaven2Script(boolean isWindows)
          If the mvnhome attribute is set, then this method returns the correct shell script to use for a specific environment.
 void setActivateProfiles(java.lang.String activateProfiles)
          Set the comma-delimited list of profiles to activate.
 void setFlags(java.lang.String flags)
          Set flags.
 void setGoal(java.lang.String goal)
           
 void setMvnHome(java.lang.String mvnHome)
          Set mvnHome.
 void setMvnScript(java.lang.String mvnScipt)
           
 void setPomFile(java.lang.String pomFile)
          Set the pom file.
 void setSettingsFile(java.lang.String settingsFile)
          Set an Alternate path for the user settings file.
 void setTimeout(long timeout)
           
 void validate()
          Check at the starting of CC if required attributes are set
 
Methods inherited from class net.sourceforge.cruisecontrol.Builder
compareTo, getGroup, getMultiple, getTime, isValidDay, setGroup, setMultiple, setTime
 
Methods inherited from class net.sourceforge.cruisecontrol.util.PerDayScheduleItem
getDay, setDay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Maven2Builder

public Maven2Builder()
Method Detail

setSettingsFile

public void setSettingsFile(java.lang.String settingsFile)
Set an Alternate path for the user settings file.

Parameters:
settingsFile - Alternate path for the user settings file.

setActivateProfiles

public void setActivateProfiles(java.lang.String activateProfiles)
Set the comma-delimited list of profiles to activate.

Parameters:
activateProfiles - comma-delimited list of profiles to activate.

setMvnHome

public void setMvnHome(java.lang.String mvnHome)
Set mvnHome. This will be used to find the mvn script which is mvnHome/bin/

Parameters:
mvnHome - the mvn home

setMvnScript

public void setMvnScript(java.lang.String mvnScipt)
Parameters:
mvnScipt - Full path to Maven script, which overrides the default ".../bin/mvn"

setPomFile

public void setPomFile(java.lang.String pomFile)
Set the pom file. This is also used to find the working directory.

Parameters:
pomFile - the pom file

setGoal

public void setGoal(java.lang.String goal)

createProperty

public Property createProperty()

setTimeout

public void setTimeout(long timeout)

validate

public void validate()
              throws CruiseControlException
Check at the starting of CC if required attributes are set

Overrides:
validate in class Builder
Throws:
CruiseControlException - When the current settings are not valid.

build

public org.jdom.Element build(java.util.Map buildProperties)
                       throws CruiseControlException
build and return the results via xml. debug status can be determined from log4j category once we get all the logging in place.

Specified by:
build in class Builder
Throws:
CruiseControlException

buildWithTarget

public org.jdom.Element buildWithTarget(java.util.Map properties,
                                        java.lang.String target)
                                 throws CruiseControlException
Specified by:
buildWithTarget in class Builder
Throws:
CruiseControlException

setFlags

public void setFlags(java.lang.String flags)
Set flags. E.g.: '-U -o'

Parameters:
flags - set the flags

findMaven2Script

protected java.lang.String findMaven2Script(boolean isWindows)
                                     throws CruiseControlException
If the mvnhome attribute is set, then this method returns the correct shell script to use for a specific environment.

Parameters:
isWindows - if True, return a path tailored for Windows (suffixed w/ .bat).
Returns:
the path to the maven launch script based on the current OS and the mvnhome attribute value
Throws:
CruiseControlException - if the mvnhome attributed is not set