hudson.maven
Class MavenModule

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by hudson.model.AbstractItem
              extended by hudson.model.Job<P,R>
                  extended by hudson.model.AbstractProject<P,R>
                      extended by hudson.maven.AbstractMavenProject<MavenModule,MavenBuild>
                          extended by hudson.maven.MavenModule
All Implemented Interfaces:
ExtensionPoint, BuildableItem, DescriptorByNameOwner, Item, ModelObject, PersistenceRoot, SubTask, Queue.Task, ResourceActivity, Saveable, SearchableModelObject, SearchItem, AccessControlled, Maven.ProjectWithMaven, ModelObjectWithContextMenu, OnMaster, org.kohsuke.stapler.HttpDeletable, org.kohsuke.stapler.StaplerOverridable

public class MavenModule
extends AbstractMavenProject<MavenModule,MavenBuild>
implements Saveable

Job that builds projects based on Maven2.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.maven.AbstractMavenProject
AbstractMavenProject.MavenModuleDependency
 
Nested classes/interfaces inherited from class hudson.model.AbstractProject
AbstractProject.AbstractProjectDescriptor, AbstractProject.BecauseOfBuildInProgress, AbstractProject.BecauseOfDownstreamBuildInProgress, AbstractProject.BecauseOfUpstreamBuildInProgress
 
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
 
Fields inherited from class hudson.model.AbstractProject
ABORT, blockBuildWhenDownstreamBuilding, blockBuildWhenUpstreamBuilding, BUILD_NOW_TEXT, builds, disabled, transientActions, triggers
 
Fields inherited from class hudson.model.Job
HISTORY_ADAPTER, nextBuildNumber, properties
 
Fields inherited from class hudson.model.AbstractItem
description, name, PRONOUN
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Fields inherited from interface hudson.model.Item
BUILD, CANCEL, CONFIGURE, CREATE, DELETE, DISCOVER, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACE
 
Method Summary
protected  void addTransientActionsFromBuild(MavenBuild build, List<Action> collection, Set<Class> added)
           
 ModuleDependency asDependency()
          Gets groupId+artifactId+version as ModuleDependency.
protected  void buildDependencyGraph(DependencyGraph graph)
          Builds the dependency graph.
protected  List<MavenReporter> createReporters()
          Creates a list of MavenReporters to be used for a build of this project.
protected  void doSetName(String name)
          Just update AbstractItem.name without performing the rename operation, which would involve copying files and etc.
protected  Collection<MavenModule> getAllMavenModules()
          Returns all Maven modules in this Jenkins instance.
 Label getAssignedLabel()
          MavenModule uses the workspace of the MavenModuleSet, so it always needs to be built on the same slave as the parent.
protected  Class<MavenBuild> getBuildClass()
          Determines Class<R>.
 List<MavenModule> getChildren()
          Gets all the child modules (that are listed in the <module> element in our POM.)
 String getDisplayName()
          Gets the human readable short name of this item.
 String getGoals()
          Gets the list of goals to execute for this module.
 JDK getJDK()
          Gets the JDK that this project is configured with, or null.
 LogRotator getLogRotator()
          MavenModule follows the same log rotation schedule as its parent.
 ModuleName getModuleName()
           
 MavenModuleSet getParent()
          This bridge method is to maintain binary compatibility with Item.getParent().
 String getPronoun()
          Get the term used in the UI to represent this kind of AbstractProject.
 DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
          Returns the live list of all Publishers configured for this project.
 String getRelativePath()
          Relative path to this module's root directory from the workspace of a MavenModuleSet.
 DescribableList<MavenReporter,Descriptor<MavenReporter>> getReporters()
          List of active MavenReporters configured for this module.
 String getShortUrl()
          Returns the URL of this item relative to the parent ItemGroup.
 List<MavenModule> getSubsidiaries()
          Computes the list of MavenModules that are 'under' this POM filesystem-wise.
 String getUserConfiguredGoals()
          Gets the list of goals specified by the user, without taking inheritance and POM default goals into account.
 String getVersion()
          Gets the version number in Maven POM as of the last build.
 Resource getWorkspaceResource()
          Deprecated. as of 1.319 in AbstractProject.
 Maven.MavenInstallation inferMavenInstallation()
          Gets the Maven.MavenInstallation associated with the project.
 boolean isBuildable()
          Returns true if we should display "build now" icon
 boolean isFingerprintConfigured()
          True if the builds of this project produces Fingerprint records.
 boolean isNameEditable()
          Returns whether the name of this job can be changed by user.
 boolean isSameModule(hudson.maven.PomInfo pom)
          Returns if the given POM likely describes the same module with the same dependencies.
protected  MavenBuild newBuild()
          Creates a new build of this project for immediate execution.
 void onLoad(ItemGroup<? extends Item> parent, String name)
          Called right after when a Item is loaded from disk.
protected  void performDelete()
          Does the real job of deleting the item.
 void setLogRotator(LogRotator logRotator)
          Deprecated. Not allowed to configure log rotation per module.
protected  void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Derived class can override this to perform additional config submission work.
 boolean supportsLogRotator()
          True if this instance supports log rotation configuration.
 String toString()
          for debug purpose
protected  void updateTransientActions()
          effectively deprecated.
 
Methods inherited from class hudson.maven.AbstractMavenProject
createTransientActions
 
Methods inherited from class hudson.model.AbstractProject
_getRuns, addProperty, addToList, addTrigger, blockBuildWhenDownstreamBuilding, blockBuildWhenUpstreamBuilding, buildDescribable, buildDescribable, checkAbortPermission, checkout, createExecutable, createHistoryWidget, disable, doBuild, doBuildWithParameters, doCancelQueue, doCheckRetryCount, doConfigSubmit, doDisable, doDoDelete, doDoWipeOutWorkspace, doEnable, doPolling, doRssChangelog, doWs, enable, findNearest, findNearest, getActions, getAssignedLabelString, getAuthToken, getBuild, getBuildByNumber, getBuildingDownstream, getBuildingUpstream, getBuildNowText, getBuildTriggerUpstreamProjects, getCauseOfBlockage, getCustomWorkspace, getDelay, getDownstreamProjects, getEnvironment, getFirstBuild, getHasCustomQuietPeriod, getIconColor, getLastBuild, getLastBuiltOn, getModuleRoot, getModuleRoots, getNearestBuild, getNearestOldBuild, getOwnerTask, getProminentActions, getQueueItem, getQuietPeriod, getRelationship, getRelevantLabels, getResourceActivities, getResourceList, getRootProject, getSameNodeConstraint, getScm, getScmCheckoutRetryCount, getScmCheckoutStrategy, getSomeBuildWithWorkspace, getSomeWorkspace, getSubTasks, getTransitiveDownstreamProjects, getTransitiveUpstreamProjects, getTrigger, getTriggers, getUpstreamProjects, getWhyBlocked, getWorkspace, hasAbortPermission, hasCustomScmCheckoutRetryCount, hasParticipant, isBuildBlocked, isConcurrentBuild, isConfigurable, isDisabled, isInQueue, isParameterized, loadBuild, makeDisabled, makeSearchIndex, onCreatedFromScratch, poll, pollSCMChanges, removeFromList, removeRun, removeTrigger, resolveForCLI, save, scheduleBuild, scheduleBuild, scheduleBuild, scheduleBuild, scheduleBuild, scheduleBuild2, scheduleBuild2, scheduleBuild2, scheduleBuild2, schedulePolling, setAssignedLabel, setAssignedNode, setBlockBuildWhenDownstreamBuilding, setBlockBuildWhenUpstreamBuilding, setConcurrentBuild, setCustomWorkspace, setJDK, setQuietPeriod, setScm, setScmCheckoutStrategy, supportsMakeDisabled
 
Methods inherited from class hudson.model.Job
assignBuildNumber, delete, doBuildStatus, doDescription, doDoRename, doRssAll, doRssFailed, getACL, getAllJobs, getAllProperties, getBuildDir, getBuildDiscarder, getBuildForCLI, getBuildHealth, getBuildHealthReports, getBuilds, getBuilds, getBuildsAsMap, getBuildsByTimestamp, getBuildStatusUrl, getBuildTimeGraph, getCharacteristicEnvVars, getDynamic, getEstimatedDuration, getLastBuildsOverThreshold, getLastCompletedBuild, getLastFailedBuild, getLastStableBuild, getLastSuccessfulBuild, getLastUnstableBuild, getLastUnsuccessfulBuild, getNewBuilds, getNextBuildNumber, getOverrides, getPermalinks, getProperties, getProperty, getProperty, getTimeline, getWidgets, isBuilding, isHoldOffBuildUntilSave, isKeepDependencies, isLogUpdated, logRotate, onCopiedFrom, removeProperty, removeProperty, renameTo, saveNextBuildNumber, setBuildDiscarder, updateNextBuildNumber
 
Methods inherited from class hudson.model.AbstractItem
checkPermission, delete, doConfigDotXml, doSubmitDescription, getAbsoluteUrl, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getRelativeNameFrom, getRelativeNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getUrl, hasPermission, setDescription, setDisplayName, setDisplayNameOrNull, updateByXml, updateByXml
 
Methods inherited from class hudson.model.Actionable
addAction, doContextMenu, getAction, getAction, getActions
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, 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.Saveable
save
 
Methods inherited from interface hudson.model.Item
delete, getAbsoluteUrl, getAllJobs, getFullDisplayName, getFullName, getName, getRelativeNameFrom, getRelativeNameFrom, getUrl, onCopiedFrom
 
Methods inherited from interface hudson.model.PersistenceRoot
getRootDir
 
Methods inherited from interface hudson.search.SearchableModelObject
getSearch
 
Methods inherited from interface hudson.search.SearchItem
getSearchIndex, getSearchName, getSearchUrl
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, getACL, hasPermission
 
Methods inherited from interface hudson.model.Queue.Task
getFullDisplayName, getName, getUrl
 
Methods inherited from interface hudson.model.queue.SubTask
getEstimatedDuration
 

Method Detail

getLogRotator

public LogRotator getLogRotator()
MavenModule follows the same log rotation schedule as its parent.

Overrides:
getLogRotator in class Job<MavenModule,MavenBuild>

setLogRotator

public void setLogRotator(LogRotator logRotator)
Deprecated. Not allowed to configure log rotation per module.

Overrides:
setLogRotator in class Job<MavenModule,MavenBuild>

supportsLogRotator

public boolean supportsLogRotator()
Description copied from class: Job
True if this instance supports log rotation configuration.

Overrides:
supportsLogRotator in class Job<MavenModule,MavenBuild>

isBuildable

public boolean isBuildable()
Description copied from class: Job
Returns true if we should display "build now" icon

Overrides:
isBuildable in class AbstractProject<MavenModule,MavenBuild>

getSubsidiaries

public List<MavenModule> getSubsidiaries()
Computes the list of MavenModules that are 'under' this POM filesystem-wise. The list doens't include this module itself.

Note that this doesn't necessary has anything to do with the module inheritance structure or parent/child relationship of the POM.


isSameModule

public boolean isSameModule(hudson.maven.PomInfo pom)
Returns if the given POM likely describes the same module with the same dependencies. Implementation needs not be 100% accurate in the true case, but it MUST return false if is not the same.


doSetName

protected void doSetName(String name)
Description copied from class: AbstractItem
Just update AbstractItem.name without performing the rename operation, which would involve copying files and etc.

Overrides:
doSetName in class AbstractItem

onLoad

public void onLoad(ItemGroup<? extends Item> parent,
                   String name)
            throws IOException
Description copied from class: AbstractItem
Called right after when a Item is loaded from disk. This is an opporunity to do a post load processing.

Specified by:
onLoad in interface Item
Overrides:
onLoad in class AbstractProject<MavenModule,MavenBuild>
name - Name of the directory (not a path --- just the name portion) from which the configuration was loaded. This usually becomes the name of this item.
Throws:
IOException

getRelativePath

public String getRelativePath()
Relative path to this module's root directory from the workspace of a MavenModuleSet. The path separator is normalized to '/'.


getVersion

public String getVersion()
Gets the version number in Maven POM as of the last build.

Returns:
This method can return null if Jenkins loaded old data that didn't record this information, so that situation needs to be handled gracefully.
Since:
1.199

getGoals

public String getGoals()
Gets the list of goals to execute for this module.


getUserConfiguredGoals

public String getUserConfiguredGoals()
Gets the list of goals specified by the user, without taking inheritance and POM default goals into account.

This is only used to present the UI screen, and in all the other cases getGoals() should be used.


getPublishersList

public DescribableList<Publisher,Descriptor<Publisher>> getPublishersList()
Description copied from class: AbstractProject
Returns the live list of all Publishers configured for this project.

This method couldn't be called getPublishers() because existing methods in sub-classes return different inconsistent types.

Specified by:
getPublishersList in class AbstractProject<MavenModule,MavenBuild>

getJDK

public JDK getJDK()
Description copied from class: AbstractProject
Gets the JDK that this project is configured with, or null.

Overrides:
getJDK in class AbstractProject<MavenModule,MavenBuild>

getBuildClass

protected Class<MavenBuild> getBuildClass()
Description copied from class: AbstractProject
Determines Class<R>.

Specified by:
getBuildClass in class AbstractProject<MavenModule,MavenBuild>

newBuild

protected MavenBuild newBuild()
                       throws IOException
Description copied from class: AbstractProject
Creates a new build of this project for immediate execution.

Overrides:
newBuild in class AbstractProject<MavenModule,MavenBuild>
Throws:
IOException

getModuleName

public ModuleName getModuleName()

asDependency

public ModuleDependency asDependency()
Gets groupId+artifactId+version as ModuleDependency.


getShortUrl

public String getShortUrl()
Description copied from interface: Item
Returns the URL of this item relative to the parent ItemGroup.

Specified by:
getShortUrl in interface Item
Overrides:
getShortUrl in class AbstractItem
Returns:
URL that ends with '/'.
See Also:
for how to implement this.

getDisplayName

@Exported(visibility=2)
public String getDisplayName()
Description copied from interface: Item
Gets the human readable short name of this item.

This method should try to return a short concise human readable string that describes this item. The string need not be unique.

The returned string should not include the display names of ancestor items.

Specified by:
getDisplayName in interface Item
Specified by:
getDisplayName in interface ModelObject
Specified by:
getDisplayName in interface ResourceActivity
Overrides:
getDisplayName in class AbstractItem

getPronoun

public String getPronoun()
Description copied from class: AbstractProject
Get the term used in the UI to represent this kind of AbstractProject. Must start with a capital letter.

Overrides:
getPronoun in class AbstractProject<MavenModule,MavenBuild>

isNameEditable

public boolean isNameEditable()
Description copied from class: Job
Returns whether the name of this job can be changed by user.

Overrides:
isNameEditable in class Job<MavenModule,MavenBuild>

getParent

public MavenModuleSet getParent()
Description copied from class: AbstractItem
This bridge method is to maintain binary compatibility with Item.getParent().

Specified by:
getParent in interface Item
Overrides:
getParent in class AbstractItem

getChildren

public List<MavenModule> getChildren()
Gets all the child modules (that are listed in the <module> element in our POM.)

This method returns null if this information is not recorded. This happens for compatibility reason.

Since:
1.133

getAssignedLabel

public Label getAssignedLabel()
MavenModule uses the workspace of the MavenModuleSet, so it always needs to be built on the same slave as the parent.

Specified by:
getAssignedLabel in interface SubTask
Overrides:
getAssignedLabel in class AbstractProject<MavenModule,MavenBuild>

getWorkspaceResource

public Resource getWorkspaceResource()
Deprecated. as of 1.319 in AbstractProject.

Workspace of a MavenModule is a part of the parent's workspace.

That is, builds are incompatible with any MavenModule builds, whereas MavenModule builds are compatible with each other.

Overrides:
getWorkspaceResource in class AbstractProject<MavenModule,MavenBuild>

isFingerprintConfigured

public boolean isFingerprintConfigured()
Description copied from class: AbstractProject
True if the builds of this project produces Fingerprint records.

Specified by:
isFingerprintConfigured in class AbstractProject<MavenModule,MavenBuild>

updateTransientActions

protected void updateTransientActions()
Description copied from class: AbstractProject
effectively deprecated. Since using updateTransientActions correctly under concurrent environment requires a lock that can too easily cause deadlocks.

Override AbstractProject.createTransientActions() instead.

Overrides:
updateTransientActions in class AbstractProject<MavenModule,MavenBuild>

buildDependencyGraph

protected void buildDependencyGraph(DependencyGraph graph)
Description copied from class: AbstractProject
Builds the dependency graph.

Specified by:
buildDependencyGraph in class AbstractProject<MavenModule,MavenBuild>
See Also:
DependencyGraph

getAllMavenModules

protected Collection<MavenModule> getAllMavenModules()
Returns all Maven modules in this Jenkins instance.


addTransientActionsFromBuild

protected void addTransientActionsFromBuild(MavenBuild build,
                                            List<Action> collection,
                                            Set<Class> added)
Specified by:
addTransientActionsFromBuild in class AbstractMavenProject<MavenModule,MavenBuild>
collection - Add the transient actions to this collection.

inferMavenInstallation

public Maven.MavenInstallation inferMavenInstallation()
Description copied from interface: Maven.ProjectWithMaven
Gets the Maven.MavenInstallation associated with the project. Can be null.

If the Maven installation can not be uniquely determined, it's often better to return just one of them, rather than returning null, since this method is currently ultimately only used to decide where to parse conf/settings.xml from.

Specified by:
inferMavenInstallation in interface Maven.ProjectWithMaven

getReporters

public DescribableList<MavenReporter,Descriptor<MavenReporter>> getReporters()
List of active MavenReporters configured for this module.


submit

protected void submit(org.kohsuke.stapler.StaplerRequest req,
                      org.kohsuke.stapler.StaplerResponse rsp)
               throws IOException,
                      javax.servlet.ServletException,
                      Descriptor.FormException
Description copied from class: Job
Derived class can override this to perform additional config submission work.

Overrides:
submit in class AbstractProject<MavenModule,MavenBuild>
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

performDelete

protected void performDelete()
                      throws IOException,
                             InterruptedException
Description copied from class: AbstractItem
Does the real job of deleting the item.

Overrides:
performDelete in class AbstractProject<MavenModule,MavenBuild>
Throws:
IOException
InterruptedException

createReporters

protected List<MavenReporter> createReporters()
Creates a list of MavenReporters to be used for a build of this project.


toString

public String toString()
for debug purpose

Overrides:
toString in class AbstractItem


Copyright © 2004-2013. All Rights Reserved.