hudson.maven
Class MavenModuleSetBuild

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.Run<P,R>
              extended by hudson.model.AbstractBuild<P,B>
                  extended by hudson.maven.AbstractMavenBuild<MavenModuleSet,MavenModuleSetBuild>
                      extended by hudson.maven.MavenModuleSetBuild
All Implemented Interfaces:
ExtensionPoint, DescriptorByNameOwner, ModelObject, PersistenceRoot, Queue.Executable, Saveable, SearchableModelObject, SearchItem, AccessControlled, Comparable<MavenModuleSetBuild>, Runnable, ModelObjectWithContextMenu, OnMaster

public class MavenModuleSetBuild
extends AbstractMavenBuild<MavenModuleSet,MavenModuleSetBuild>

Build for MavenModuleSet.

A "build" of MavenModuleSet consists of:

  1. Update the workspace.
  2. Parse POMs
  3. Trigger module builds.
This object remembers the changelog and what MavenBuilds are done on this.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class MavenModuleSetBuild.SimpleTransferListener
          will log in the TaskListener when transferFailed and transferSucceeded
 
Nested classes/interfaces inherited from class hudson.model.AbstractBuild
AbstractBuild.AbstractBuildExecution, AbstractBuild.AbstractRunner, AbstractBuild.DependencyChange
 
Nested classes/interfaces inherited from class hudson.model.Run
Run.Artifact, Run.ArtifactList, Run.KeepLogBuildBadge, Run.RedirectUp, Run.RunExecution, Run.Runner, Run.RunnerAbortedException, Run.Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem
 
Field Summary
static boolean debug
          Extra verbose debug switch.
 
Fields inherited from class hudson.model.AbstractBuild
buildEnvironments
 
Fields inherited from class hudson.model.Run
ARTIFACTS, charset, DELETE, description, duration, FEED_ADAPTER, FEED_ADAPTER_LATEST, ID_FORMATTER, LIST_CUTOFF, number, ORDER_BY_DATE, PERMISSIONS, project, result, state, timestamp, TREE_CUTOFF, UPDATE, XSTREAM, XSTREAM2
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
MavenModuleSetBuild(MavenModuleSet job)
           
MavenModuleSetBuild(MavenModuleSet project, File buildDir)
           
 
Method Summary
 void delete()
          Deletes this build and its entire log
<T extends Action>
List<T>
findModuleBuildActions(Class<T> action)
          Finds Actions from all the module builds that belong to this MavenModuleSetBuild.
 Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that)
          Gets the dependency relationship from this build (as the source) and that project (as the sink.)
 Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 EnvVars getEnvironment(TaskListener log)
          Exposes MAVEN_OPTS to forked processes.
 long getEstimatedDuration()
          Returns the estimated duration for this builds.
 MavenAggregatedArtifactRecord getMavenArtifacts()
          Information about artifacts produced by Maven.
 String getMavenOpts(TaskListener listener, EnvVars envVars)
          Obtains the fully resolved MAVEN_OPTS with all the tokens and variables expanded.
 String getMavenVersionUsed()
          Gets the version of Maven used for build.
 Map<MavenModule,List<MavenBuild>> getModuleBuilds()
          Computes the module builds that correspond to this build.
 Map<MavenModule,MavenBuild> getModuleLastBuilds()
          Computes the latest module builds that correspond to this build.
 MavenModuleSet getParent()
          The project this build is for.
 Result getResult()
          Displays the combined status of all modules.
protected  void onLoad()
          Called after the build is loaded and the object is added to the build list.
 void registerAsProjectAction(MavenReporter reporter)
           
 void run()
          Invoked by Executor to performs a build.
 void setMavenVersionUsed(String mavenVersionUsed)
           
 
Methods inherited from class hudson.maven.AbstractMavenBuild
expandTokens
 
Methods inherited from class hudson.model.AbstractBuild
doStop, doStop, due, getAggregatedTestResultAction, getBuildFingerprints, getBuildVariableResolver, getBuildVariables, getBuiltOn, getBuiltOnStr, getChangeSet, getCulprits, getDependencyChanges, getDownstreamBuilds, getDownstreamBuilds, getEnvironments, getHudsonVersion, getModuleRoot, getModuleRoots, getNextBuild, getPersistentActions, getPreviousBuild, getProject, getRootBuild, getSensitiveBuildVariables, getTestResultAction, getTransitiveUpstreamBuilds, getUpstreamBuilds, getUpstreamRelationship, getUpstreamRelationshipBuild, getUpUrl, getWhyKeepLog, getWorkspace, hasChangeSetComputed, hasParticipant, setBuiltOnStr, setWorkspace
 
Methods inherited from class hudson.model.Run
_this, addAction, canToggleLogKeep, checkPermission, compareTo, deleteArtifacts, doArtifact, doBuildNumber, doBuildStatus, doBuildTimestamp, doConfigSubmit, doConsoleText, doDoDelete, doProgressiveLog, doSubmitDescription, doToggleLogKeep, execute, fromExternalizableId, getAbsoluteUrl, getACL, getApi, getArtifacts, getArtifactsDir, getArtifactsUpTo, getBadgeActions, getBuildStatusSummary, getBuildStatusUrl, getCause, getCauses, getCharacteristicEnvVars, getCharset, getDescription, getDescriptorByName, getDisplayName, getDuration, getDurationString, getEnvironment, getEnvVars, getExecutor, getExternalizableId, getFullDisplayName, getHasArtifacts, getIconColor, getId, getIDFormatter, getLog, getLog, getLogFile, getLogInputStream, getLogReader, getLogText, getNumber, getOneOffExecutor, getPreviousBuildInProgress, getPreviousBuildsOverThreshold, getPreviousBuiltBuild, getPreviousCompletedBuild, getPreviousFailedBuild, getPreviousNotFailedBuild, getPreviousSuccessfulBuild, getRootDir, getSearchUrl, getStartTimeInMillis, getTime, getTimeInMillis, getTimestamp, getTimestampString, getTimestampString2, getTransientActions, getTruncatedDescription, getUrl, hasCustomDisplayName, hasntStartedYet, hasPermission, isBuilding, isKeepLog, isLogUpdated, keepLog, keepLog, makeSearchIndex, onEndBuilding, onStartBuilding, reload, run, save, setDescription, setDisplayName, setResult, submit, toString, writeLogTo, writeWholeLogTo
 
Methods inherited from class hudson.model.Actionable
doContextMenu, getAction, getAction, getActions, getActions
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hudson.model.Queue.Executable
toString
 

Field Detail

debug

public static boolean debug
Extra verbose debug switch.

Constructor Detail

MavenModuleSetBuild

public MavenModuleSetBuild(MavenModuleSet job)
                    throws IOException
Throws:
IOException

MavenModuleSetBuild

public MavenModuleSetBuild(MavenModuleSet project,
                           File buildDir)
                    throws IOException
Throws:
IOException
Method Detail

onLoad

protected void onLoad()
Description copied from class: Run
Called after the build is loaded and the object is added to the build list.

Overrides:
onLoad in class Run<MavenModuleSet,MavenModuleSetBuild>

getEnvironment

public EnvVars getEnvironment(TaskListener log)
                       throws IOException,
                              InterruptedException
Exposes MAVEN_OPTS to forked processes. When we fork Maven, we do so directly by executing Java, thus this environment variable is pointless (we have to tweak JVM launch option correctly instead, which can be seen in MavenProcessFactory), but setting the environment variable explicitly is still useful in case this Maven forks other Maven processes via normal way. See HUDSON-3644.

Overrides:
getEnvironment in class AbstractMavenBuild<MavenModuleSet,MavenModuleSetBuild>
Returns:
the map with the environmental variables. Never null.
Throws:
IOException
InterruptedException

getResult

public Result getResult()
Displays the combined status of all modules.

More precisely, this picks up the status of this build itself, plus all the latest builds of the modules that belongs to this build.

Overrides:
getResult in class Run<MavenModuleSet,MavenModuleSetBuild>

getModuleBuilds

public Map<MavenModule,List<MavenBuild>> getModuleBuilds()
Computes the module builds that correspond to this build.

A module may be built multiple times (by the user action), so the value is a list.


getEstimatedDuration

public long getEstimatedDuration()
Returns the estimated duration for this builds. Takes only the modules into account which are actually being build in case of incremental builds.

Specified by:
getEstimatedDuration in interface Queue.Executable
Overrides:
getEstimatedDuration in class Run<MavenModuleSet,MavenModuleSetBuild>
Returns:
the estimated duration in milliseconds
Since:
1.383

getMavenVersionUsed

@Exported
public String getMavenVersionUsed()
Gets the version of Maven used for build.

Returns:
null if this build is done by earlier version of Jenkins that didn't record this information (this means the build was done by Maven2.x)

setMavenVersionUsed

public void setMavenVersionUsed(String mavenVersionUsed)
                         throws IOException
Throws:
IOException

delete

public void delete()
            throws IOException
Description copied from class: Run
Deletes this build and its entire log

Overrides:
delete in class Run<MavenModuleSet,MavenModuleSetBuild>
Throws:
IOException - if we fail to delete.

getDynamic

public Object getDynamic(String token,
                         org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
Overrides:
getDynamic in class Run<MavenModuleSet,MavenModuleSetBuild>

getMavenArtifacts

@Exported
public MavenAggregatedArtifactRecord getMavenArtifacts()
Information about artifacts produced by Maven.


getModuleLastBuilds

public Map<MavenModule,MavenBuild> getModuleLastBuilds()
Computes the latest module builds that correspond to this build. (when individual modules are built, a new ModuleSetBuild is not created, but rather the new module build falls under the previous ModuleSetBuild)


registerAsProjectAction

public void registerAsProjectAction(MavenReporter reporter)

findModuleBuildActions

public <T extends Action> List<T> findModuleBuildActions(Class<T> action)
Finds Actions from all the module builds that belong to this MavenModuleSetBuild. One action per one MavenModule, and newer ones take precedence over older ones.


run

public void run()
Description copied from class: AbstractBuild
Invoked by Executor to performs a build.

Specified by:
run in interface Queue.Executable
Specified by:
run in interface Runnable
Specified by:
run in class AbstractBuild<MavenModuleSet,MavenModuleSetBuild>

getDownstreamRelationship

public Fingerprint.RangeSet getDownstreamRelationship(AbstractProject that)
Description copied from class: AbstractBuild
Gets the dependency relationship from this build (as the source) and that project (as the sink.)

Overrides:
getDownstreamRelationship in class AbstractBuild<MavenModuleSet,MavenModuleSetBuild>
Returns:
range of build numbers that represent which downstream builds are using this build. The range will be empty if no build of that project matches this (or there is no Fingerprinter.FingerprintAction), but it'll never be null.

getMavenOpts

public String getMavenOpts(TaskListener listener,
                           EnvVars envVars)
Description copied from class: AbstractMavenBuild
Obtains the fully resolved MAVEN_OPTS with all the tokens and variables expanded.

Specified by:
getMavenOpts in class AbstractMavenBuild<MavenModuleSet,MavenModuleSetBuild>
envVars - Caller must pass in the environment variables obtained from AbstractMavenBuild.getEnvironment(TaskListener) This method takes this as a parameter as opposed to recomputing it since the caller always have this handy.
See Also:
MavenModuleSet.getMavenOpts()

getParent

public MavenModuleSet getParent()
Description copied from class: Run
The project this build is for.

Specified by:
getParent in interface Queue.Executable
Overrides:
getParent in class Run<MavenModuleSet,MavenModuleSetBuild>


Copyright © 2004-2013. All Rights Reserved.