com.atlassian.bamboo.builder
Class AbstractMavenBuilder

java.lang.Object
  extended by com.atlassian.bamboo.command.Command
      extended by com.atlassian.bamboo.builder.AbstractBuilder
          extended by com.atlassian.bamboo.builder.AbstractMavenBuilder
All Implemented Interfaces:
Builder, EnvironmentVariablesAwareBuilder, MutableEnvironmentVariablesAwareBuilder, InitablePluginModule, BambooPluginModule, BuildConfigurationAwarePlugin, BuilderV2, ConfigurablePlugin, java.io.Serializable
Direct Known Subclasses:
Maven2Builder, Maven3Builder, MavenBuilder

public abstract class AbstractMavenBuilder
extends AbstractBuilder

See Also:
Serialized Form

Field Summary
static java.lang.String CUSTOM_TEST_DIRECTORY_SELECTED
           
protected  java.lang.String goal
           
static java.lang.String LOCAL_REPOSITORY_PROPERTY_NAME
          Name of the property passed to maven to point to the different local repository
static java.lang.String PARAM_GOAL
           
static java.lang.String PARAM_TEST_DIRECTORY_OPTION
           
static java.lang.String STANDARD_TEST_DIRECTORY_SELECTED
           
protected  java.lang.String testDirectoryOption
           
 
Fields inherited from class com.atlassian.bamboo.builder.AbstractBuilder
BUILD_FAILED_MARKER, BUILD_SUCCESSFUL_MARKER, buildDirectoryManager, DEFAULT_TEST_REPORTS_XML, errorUpdateHandler, FIND_FAILURE_MESSAGE_IN_LAST, FIND_SUCCESS_MESSAGE_IN_LAST, PARAM_BUILD_LABEL, PARAM_BUILDJDK, PARAM_ENV_VAR, PARAM_HASTESTS, PARAM_HOME, PARAM_PROJECT_FILE, PARAM_TEST_RESULTS_DIRECTORY, PARAM_WORKING_SUB_DIR, SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE, templateRenderer
 
Fields inherited from class com.atlassian.bamboo.command.Command
buildLoggerManager, CBD_BUILD_COMMANDLINE, substitutionBean
 
Fields inherited from interface com.atlassian.bamboo.builder.Builder
CAPABILITY_BUILDER_PREFIX, CAPABILITY_BUILDER_TYPE
 
Constructor Summary
AbstractMavenBuilder()
           
 
Method Summary
 void addDefaultValues(BuildConfiguration configuration)
          Extension point for adding default values to the form for BuildConfigurationAwarePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
 java.lang.String[] getCommandArguments(ReadOnlyCapabilitySet capabilitySet)
          What are the arguments for the command line to execute.
 java.lang.String getCommandExecutable(ReadOnlyCapabilitySet capabilitySet)
          What is the executable for the command line to execute
protected abstract  java.lang.String getDefaultTestReportsDirectory()
           
protected abstract  java.lang.String getExecutableFileName()
          Gets the executable file name
 java.util.Map<java.lang.String,java.lang.String> getFullParams()
          Gets the full params that's used to persist.
 java.lang.String getGoal()
          Which goal will maven use to build the build?
protected  java.lang.String getMavenExecutablePath(java.lang.String homePath)
           
protected  java.lang.String getMavenVersion(java.lang.String homePath)
          Parse output of "mvn --version".
protected  java.util.Map<java.lang.String,java.lang.Object> getTemplateContext()
           
 java.lang.String getTestDirectory()
          Which test directory option are we using "standardTestDirectory:, or a "customTestDirectory"
 java.lang.String getTestResultsDirectory()
          Return the default
 boolean hasPassed(int returnCode, int buildNumber, java.lang.String planKey)
          Determines based on the return code and/or logs whether the build has passed.
 boolean isForceRepositoryIsolation()
          Forces the redirection of the local Maven repository to a temporary location
 boolean isPathValid(java.lang.String homeDirectory)
          Does the home dir contain /bin/ant?
 void setForceRepositoryIsolation(boolean forceRepositoryIsolation)
           
 void setGoal(java.lang.String goal)
          Set the goal that the build will execute.
 void setParams(FilteredMap filteredBuilderParams)
          Updates the current builder object with
 void setTestDirectory(java.lang.String testDirectory)
          Let the UI specify which test directory option we're using - standard or custom.
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 ErrorCollection validate(FilteredMap filteredParams)
          Validate that the goal has been defined
 
Methods inherited from class com.atlassian.bamboo.builder.AbstractBuilder
collateTestResults, customiseLabelTypeMap, customizeBuildRequirements, executeBuild, getBuildDir, getBuildDirectoryManager, getBuildJdk, getCapabilityPrefix, getCompleteKey, getEditHtml, getEnvironmentVariables, getFilteredParams, getKey, getKeyPrefix, getLabel, getPath, getPathHelp, getProjectFile, getSubstitutedEnvironmentVariables, getTestChecked, getViewHtml, getWorkingDirectory, getWorkingSubDirectory, hasTests, init, isJdkValid, isLabelPathMapConfigurable, outputEndsWith, populateBuildErrors, prepareConfigObject, removeAllSystemJdkRequirements, removeBuildRequirements, runBuild, setAdministrationConfiguration, setBuildDir, setBuildDirectoryManager, setBuildJdk, setBuildLogFileAccessorFactory, setEnvironmentVariables, setErrorUpdateHandler, setHasTests, setJdkManager, setKey, setLabel, setProjectFile, setTemplateRenderer, setTestChecked, setTestResultsDirectory, setWorkingSubDirectory, toString, validate
 
Methods inherited from class com.atlassian.bamboo.command.Command
decorateCommandLine, executeCommand, getBuildLoggerManager, getCommandLine, getCustomEnvironmentVars, getEnvironmentSetting, getSubstitutedCommandLine, getVariableSubstitutionBean, isWindowsPlatform, setBuildLoggerManager, setPluginAccessor, setVariableSubstitutionBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.builder.Builder
addDefaultLabelPathMaps, getName
 

Field Detail

goal

protected java.lang.String goal

testDirectoryOption

protected java.lang.String testDirectoryOption

PARAM_GOAL

public static final java.lang.String PARAM_GOAL
See Also:
Constant Field Values

PARAM_TEST_DIRECTORY_OPTION

public static final java.lang.String PARAM_TEST_DIRECTORY_OPTION
See Also:
Constant Field Values

CUSTOM_TEST_DIRECTORY_SELECTED

public static final java.lang.String CUSTOM_TEST_DIRECTORY_SELECTED
See Also:
Constant Field Values

STANDARD_TEST_DIRECTORY_SELECTED

public static final java.lang.String STANDARD_TEST_DIRECTORY_SELECTED
See Also:
Constant Field Values

LOCAL_REPOSITORY_PROPERTY_NAME

public static final java.lang.String LOCAL_REPOSITORY_PROPERTY_NAME
Name of the property passed to maven to point to the different local repository

See Also:
Constant Field Values
Constructor Detail

AbstractMavenBuilder

public AbstractMavenBuilder()
Method Detail

hasPassed

public boolean hasPassed(int returnCode,
                         int buildNumber,
                         java.lang.String planKey)
Description copied from interface: BuilderV2
Determines based on the return code and/or logs whether the build has passed. Implementors should log how they came up with their conclusions -

Specified by:
hasPassed in interface BuilderV2
Overrides:
hasPassed in class AbstractBuilder
Parameters:
returnCode - return code from build execution command
planKey - @return true if build has passed

getCommandExecutable

@NotNull
public java.lang.String getCommandExecutable(ReadOnlyCapabilitySet capabilitySet)
What is the executable for the command line to execute

Overrides:
getCommandExecutable in class Command
Parameters:
capabilitySet - hopefully containing the correct paths for this builder
Returns:
the executable as a string

getCommandArguments

@NotNull
public java.lang.String[] getCommandArguments(ReadOnlyCapabilitySet capabilitySet)
What are the arguments for the command line to execute. Assumption is made that in Windows Maven executables are .bat scripts

Overrides:
getCommandArguments in class Command
Parameters:
capabilitySet - - capabilitySet for the local context
Returns:
the executable as a string[]. Spaces/division of strings in the array should not matter etc should not matter.

getMavenExecutablePath

@NotNull
protected java.lang.String getMavenExecutablePath(@NotNull
                                                          java.lang.String homePath)

getMavenVersion

@Nullable
protected java.lang.String getMavenVersion(@NotNull
                                                    java.lang.String homePath)
Parse output of "mvn --version". This method works only with Maven 2 and Maven 3

Parameters:
homePath - maven home directory
Returns:
text representation of Maven version number or null if not possible to obtain version number

getExecutableFileName

protected abstract java.lang.String getExecutableFileName()
Gets the executable file name

Returns:
The executable file name

setGoal

public void setGoal(java.lang.String goal)
Set the goal that the build will execute. This can be a single goal, such as "java:compile", or multiple goals, such as "clean test".

Parameters:
goal - The maven goal

getGoal

public java.lang.String getGoal()
Which goal will maven use to build the build?

Returns:
the name of the Maven goal

getTestResultsDirectory

public java.lang.String getTestResultsDirectory()
Return the default

Overrides:
getTestResultsDirectory in class AbstractBuilder
Returns:
maven test results

getDefaultTestReportsDirectory

protected abstract java.lang.String getDefaultTestReportsDirectory()

getTestDirectory

public java.lang.String getTestDirectory()
Which test directory option are we using "standardTestDirectory:, or a "customTestDirectory"

Returns:
Test directory

setTestDirectory

public void setTestDirectory(java.lang.String testDirectory)
Let the UI specify which test directory option we're using - standard or custom.

Parameters:
testDirectory - Test directory to be set

setParams

public void setParams(@NotNull
                      FilteredMap filteredBuilderParams)
Description copied from interface: Builder
Updates the current builder object with

Specified by:
setParams in interface Builder
Overrides:
setParams in class AbstractBuilder
Parameters:
filteredBuilderParams - - Filtered Map with the prefix builder key stripped out

validate

public ErrorCollection validate(FilteredMap filteredParams)
Validate that the goal has been defined

Specified by:
validate in class AbstractBuilder
Parameters:
filteredParams -
Returns:
The collection of validation errors. An empty list if there are no errors

validate

@NotNull
public ErrorCollection validate(@NotNull
                                        BuildConfiguration buildConfiguration)
Description copied from interface: BuildConfigurationAwarePlugin
Validates the properties in the BuildConfiguration object. The name of the properties match those passed in through the form fragments in BuildConfigurationAwarePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) template.

Parameters:
buildConfiguration - - @NotNull
Returns:
ErrorCollection keyed by the field name. @NotNull

addDefaultValues

public void addDefaultValues(@NotNull
                             BuildConfiguration configuration)
Description copied from interface: BuildConfigurationAwarePlugin
Extension point for adding default values to the form for BuildConfigurationAwarePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)

Parameters:
configuration - - @NotNull

getFullParams

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getFullParams()
Description copied from interface: Builder
Gets the full params that's used to persist.

Specified by:
getFullParams in interface Builder
Overrides:
getFullParams in class AbstractBuilder
Returns:
Map key by the full param key (e.g. builder.ant.label). Never null

isPathValid

public boolean isPathValid(java.lang.String homeDirectory)
Does the home dir contain /bin/ant?

Parameters:
homeDirectory - Home directory to be modified
Returns:
true if valid

isForceRepositoryIsolation

public boolean isForceRepositoryIsolation()
Forces the redirection of the local Maven repository to a temporary location

Returns:
enabled

setForceRepositoryIsolation

public void setForceRepositoryIsolation(boolean forceRepositoryIsolation)

getTemplateContext

protected java.util.Map<java.lang.String,java.lang.Object> getTemplateContext()
Overrides:
getTemplateContext in class AbstractBuilder


Copyright © 2011 Atlassian. All Rights Reserved.