com.atlassian.maven.plugins.sourcerelease.mojos
Class AbstractSourceDistributionMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.atlassian.maven.plugins.sourcerelease.mojos.AbstractSourceDistributionMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
ListMojo, SourceMojo

public abstract class AbstractSourceDistributionMojo
extends org.apache.maven.plugin.AbstractMojo

Does most of the heavy lifting for resolving what projects will be checked out

Since:
v1.4

Field Summary
protected  java.lang.String addToAllMaven
          Allows the specification of maven arguments that will be added to all maven commands
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
protected  java.lang.String artifactId
          ArtifactId of the generated source release pom
protected  java.lang.String baseProject
          The maven project representing the actual product this is being built for
protected  BuildConfiguration[] buildConfigurations
          Allows custom build configuration for each dependency
protected  boolean buildScript
          Generate a build script that builds each dependent project seperately.
protected  java.lang.String buildScriptNamePrefix
          Allows renaming of the outputted build script prefix
protected  boolean buildScriptWithTests
          Generate a build script that builds each dependent project seperately, and runs all tests
protected  java.lang.String checkoutDirectoryName
          Directory name of the location in the output directory where the source release project will be generated
protected  boolean debugSkipCheckout
          Set to true to skip time consuming checkouts for debugging purposes
protected  java.util.List dependencyExclusions
          List of artifacts to exclude from the source release including all their dependencies.
protected  java.util.List exclusions
          List of artifacts to exclude from the source release.
protected  FinalMavenBuildCommand[] finalMavenBuildCommands
          The commands that should be run after all the dependencies are built.
protected  boolean generatePom
          Upload a POM for this artifact.
protected  java.lang.String groupId
          GroupId of the generated pom
protected  java.lang.String groupIdMask
          Mask of groupId to include in source release (eg.
protected  boolean hgSubFolders
          Whether or not to mimic SVN checkouts with hg, i.e.
protected  boolean ignoreFailures
          Whether to ignore export failures or not.
protected  boolean includeRootProject
          The source distribution plugin will not add the root project, i.e.
protected  java.lang.String includeSettingsFile
          Allows changing the settings file name to be shipped with the source distro.
protected  java.lang.String localRepoDirectory
          Is useLocalRepo is set, this is the directory that will be used
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
           
protected  java.util.Map<org.apache.maven.project.MavenProject,MavenVersion> mavenVersionMap
           
protected  org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource
           
protected  java.io.File outputDirectory
          Location of the file.
protected  java.lang.String productName
          Product Name of the generated pom (eg.
protected  org.apache.maven.project.MavenProject project
           
protected  org.apache.maven.project.MavenProjectBuilder projectBuilder
           
protected  java.util.List<org.apache.maven.project.MavenProject> reactorProjects
          All projects listed in the reactor
protected  ReleaseArtifactMapping[] releaseArtifactMappings
          Allows overriding of artifacts tag prefixes.
protected  java.util.List remoteRepositories
           
protected  RepositoryMapping[] repositoryMappings
          Specific source dependency configurations
protected  org.apache.maven.artifact.resolver.ArtifactResolver resolver
           
protected  boolean resolveRoot
          Whether to resolve and check out the parent project for modules of a multi-module projects
protected  java.util.List scmPrefixExclusions
          List of exclusions based on scm prefix
protected  org.apache.maven.settings.Settings settings
           
protected  java.lang.String settingsFileName
          The path to the settings file to be used with the build script
protected  boolean skip
          Skips the execution
protected  SourceDependency[] sourceDependencies
          Deprecated. Use RepositoryMapping instead. Since v1.4.4.
protected  boolean useReactor
          Whether to use the reactor artifacts for dependency resolution or the artifacts in the source distribution pom.
protected  java.lang.String version
          Version of the generated pom
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSourceDistributionMojo()
           
 
Method Summary
protected  void applyModuleMapping(java.util.Map<java.lang.String,java.lang.String> moduleMapping, org.apache.maven.project.MavenProject mavenProject)
          Applies a module mapping for sub modules with paths different from their artifactId.
protected  ReleaseArtifactMapping determineReleaseArtifactMappingForProject(org.apache.maven.project.MavenProject project)
           
protected  BuildConfiguration findBuildConfiguration(java.lang.String groupId, java.lang.String artifactId)
          find if there is a build config for a particular artifact.
protected  java.util.Set<org.apache.maven.project.MavenProject> getResolvedProjects()
          Resolves the set of projects which will be checked out.
protected  org.apache.maven.project.MavenProject resolveRootProject(org.apache.maven.project.MavenProject mavenProject)
          Resolves the root, parent project in a multi module project set up.
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

outputDirectory

protected java.io.File outputDirectory
Location of the file.


generatePom

protected boolean generatePom
Upload a POM for this artifact. Will generate a default POM if none is supplied with the pomFile argument.


buildScript

protected boolean buildScript
Generate a build script that builds each dependent project seperately.


buildScriptNamePrefix

protected java.lang.String buildScriptNamePrefix
Allows renaming of the outputted build script prefix


buildScriptWithTests

protected boolean buildScriptWithTests
Generate a build script that builds each dependent project seperately, and runs all tests


localRepoDirectory

protected java.lang.String localRepoDirectory
Is useLocalRepo is set, this is the directory that will be used


groupId

protected java.lang.String groupId
GroupId of the generated pom


artifactId

protected java.lang.String artifactId
ArtifactId of the generated source release pom


version

protected java.lang.String version
Version of the generated pom


productName

protected java.lang.String productName
Product Name of the generated pom (eg. Atlassian Confluence)


checkoutDirectoryName

protected java.lang.String checkoutDirectoryName
Directory name of the location in the output directory where the source release project will be generated


groupIdMask

protected java.lang.String groupIdMask
Mask of groupId to include in source release (eg. "com.atlassian." or "org.apache.maven.plugins." )


exclusions

protected java.util.List exclusions
List of artifacts to exclude from the source release. Format "groupId:artifactId"


dependencyExclusions

protected java.util.List dependencyExclusions
List of artifacts to exclude from the source release including all their dependencies. Format "groupId:artifactId"


skip

protected boolean skip
Skips the execution


resolveRoot

protected boolean resolveRoot
Whether to resolve and check out the parent project for modules of a multi-module projects


ignoreFailures

protected boolean ignoreFailures
Whether to ignore export failures or not. All failures will be batched up and logged at the end.


sourceDependencies

protected SourceDependency[] sourceDependencies
Deprecated. Use RepositoryMapping instead. Since v1.4.4.
Specific source dependency configurations


scmPrefixExclusions

protected java.util.List scmPrefixExclusions
List of exclusions based on scm prefix


hgSubFolders

protected boolean hgSubFolders
Whether or not to mimic SVN checkouts with hg, i.e. only keep relevant subfolders.


repositoryMappings

protected RepositoryMapping[] repositoryMappings
Specific source dependency configurations


releaseArtifactMappings

protected ReleaseArtifactMapping[] releaseArtifactMappings
Allows overriding of artifacts tag prefixes.


buildConfigurations

protected BuildConfiguration[] buildConfigurations
Allows custom build configuration for each dependency


addToAllMaven

protected java.lang.String addToAllMaven
Allows the specification of maven arguments that will be added to all maven commands


includeSettingsFile

protected java.lang.String includeSettingsFile
Allows changing the settings file name to be shipped with the source distro. It should include Atlassian Public and Atlassian Config repos. The plugin will attempt to copy this file into the source distribution into the filename specified with settingsFileName


settingsFileName

protected java.lang.String settingsFileName
The path to the settings file to be used with the build script


finalMavenBuildCommands

protected FinalMavenBuildCommand[] finalMavenBuildCommands
The commands that should be run after all the dependencies are built. For example this may be the maven involation to actually build and package the WAR.


useReactor

protected boolean useReactor
Whether to use the reactor artifacts for dependency resolution or the artifacts in the source distribution pom. If false, the dependencies of the project are resolved transitively and filtered to include only runtime and compile scopes.


includeRootProject

protected boolean includeRootProject
The source distribution plugin will not add the root project, i.e. the project calling the plugin, into the distribution, since usually customers shouldn't get the it. Set this parameter to true if that behaviour is not desired.


project

protected org.apache.maven.project.MavenProject project

baseProject

protected java.lang.String baseProject
The maven project representing the actual product this is being built for


artifactFactory

protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory

reactorProjects

protected java.util.List<org.apache.maven.project.MavenProject> reactorProjects
All projects listed in the reactor


projectBuilder

protected org.apache.maven.project.MavenProjectBuilder projectBuilder

resolver

protected org.apache.maven.artifact.resolver.ArtifactResolver resolver

settings

protected org.apache.maven.settings.Settings settings

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository

remoteRepositories

protected java.util.List remoteRepositories

metadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource metadataSource

mavenVersionMap

protected java.util.Map<org.apache.maven.project.MavenProject,MavenVersion> mavenVersionMap

debugSkipCheckout

protected boolean debugSkipCheckout
Set to true to skip time consuming checkouts for debugging purposes

Constructor Detail

AbstractSourceDistributionMojo

public AbstractSourceDistributionMojo()
Method Detail

getResolvedProjects

protected java.util.Set<org.apache.maven.project.MavenProject> getResolvedProjects()
                                                                            throws org.apache.maven.plugin.MojoExecutionException
Resolves the set of projects which will be checked out. If useReactor is true, will resolve the initial set of projects based on those in the reactor. Otherwise, projects will be resolved based on the transitive dependencies of the module invoking this plugin. This initial set of projects will then undergo a set of transformations if they match any RepositoryMapping configurations specified.

Returns:
the set of maven projects that will be checked out
Throws:
org.apache.maven.plugin.MojoExecutionException

resolveRootProject

protected org.apache.maven.project.MavenProject resolveRootProject(org.apache.maven.project.MavenProject mavenProject)
Resolves the root, parent project in a multi module project set up. It tries to figure this out based on the current SCM resolved for the project. e.g. for project
foobar
with resolved scm of
scm:svn:http://svn.atlassian.com/foo/bar/foobar/tags/foo-1.0
, will determine the number of path elements to foobar (foo/bar) and traverse up the hierarchy twice to return the MavenProject corresponding to
foo
.

Parameters:
mavenProject - the module to start upward resolution from
Returns:
the parent maven project

applyModuleMapping

protected void applyModuleMapping(java.util.Map<java.lang.String,java.lang.String> moduleMapping,
                                  org.apache.maven.project.MavenProject mavenProject)
Applies a module mapping for sub modules with paths different from their artifactId. When maven does scm path resolution for sub modules, it implicitly assumes the sub module's scm path follows its artifactId. Specify moduleMappings in a sourceDependency configuration should this be the case.

Parameters:
moduleMapping -
mavenProject -

findBuildConfiguration

protected BuildConfiguration findBuildConfiguration(java.lang.String groupId,
                                                    java.lang.String artifactId)
find if there is a build config for a particular artifact. If not, return a default maven 2 config

Parameters:
artifactId -
Returns:

determineReleaseArtifactMappingForProject

protected ReleaseArtifactMapping determineReleaseArtifactMappingForProject(org.apache.maven.project.MavenProject project)
Parameters:
project - the maven project to look up in the mapping.
Returns:
the release artifact mapping if one is found otherwise null


Copyright © 2012 Atlassian. All Rights Reserved.