public abstract class AbstractInvokerMojo
extends org.apache.maven.plugin.AbstractMojo
Modifier and Type | Class and Description |
---|---|
(package private) static class |
AbstractInvokerMojo.ToolchainPrivateManager |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
actualMavenVersion
The version of Maven which is used to run the builds
|
private boolean |
addTestClassPath
A flag whether the test class path of the project under test should be included in the class path of the
pre-/post-build scripts.
|
private boolean |
cloneAllFiles
Some files are normally excluded when copying the IT projects from the directory specified by the parameter
projectsDirectory to the directory given by cloneProjectsTo (e.g.
|
private boolean |
cloneClean
Ensure the
cloneProjectsTo directory is not polluted with files from earlier invoker runs. |
private java.io.File |
cloneProjectsTo
Directory to which projects should be cloned prior to execution.
|
private boolean |
debug
Whether to show debug statements in the build output.
|
private boolean |
disableReports
A flag to disable the generation of build reports.
|
private java.lang.String |
encoding
The file encoding for the pre-/post-build scripts and the list files for goals and profiles.
|
private java.util.Map<java.lang.String,java.lang.String> |
environmentVariables
Additional environment variables to set on the command line.
|
private java.lang.String |
filteredPomPrefix
A string used to prefix the file name of the filtered POMs in case the POMs couldn't be filtered in-place (i.e.
|
private java.util.Map<java.lang.String,java.lang.String> |
filterProperties
A list of additional properties which will be used to filter tokens in POMs and goal files.
|
private java.util.List<java.lang.String> |
goals
The list of goals to execute on each project.
|
private org.apache.maven.shared.invoker.Invoker |
invoker |
private java.lang.String |
invokerPropertiesFile
The name of an optional project-specific file that contains properties used to specify settings for an individual
Maven invocation.
|
private java.lang.String |
invokerTest
A comma separated list of projectname patterns to run.
|
private java.io.File |
javaHome
The
JAVA_HOME environment variable to use for forked Maven invocations. |
private java.io.File |
localRepositoryPath
The local repository for caching artifacts.
|
private java.io.File |
logDirectory
By default a
build.log is created in the root of the project. |
private java.lang.String |
mavenExecutable
mavenExecutable can either be a file relative to
${maven.home}/bin/ or an absolute file. |
private java.io.File |
mavenHome
The home directory of the Maven installation to use for the forked builds.
|
private java.lang.String |
mavenOpts
The
MAVEN_OPTS environment variable to use when invoking Maven. |
private boolean |
mergeUserSettings
If enable and if you have a settings file configured for the execution, it will be merged with your user
settings.
|
private org.apache.maven.plugin.MojoExecution |
mojoExecution |
private boolean |
noLog
Suppress logging to the
build.log file. |
private int |
parallelThreads
number of threads for running tests in parallel.
|
private java.util.List<org.apache.maven.artifact.Artifact> |
pluginArtifacts |
private java.io.File |
pom
A single POM to build, skipping any scanning parameters and behavior.
|
private java.util.List<java.lang.String> |
pomExcludes
Exclude patterns for searching the integration test directory.
|
private java.util.List<java.lang.String> |
pomIncludes
Include patterns for searching the integration test directory for projects.
|
private java.lang.String |
postBuildHookScript
Relative path of a cleanup/verification hook script to run after executing the build.
|
private java.lang.String |
preBuildHookScript
Relative path of a pre-build hook script to run prior to executing the build.
|
private java.util.List<java.lang.String> |
profiles
List of profile identifiers to explicitly trigger in the build.
|
private org.apache.maven.project.MavenProject |
project
The Maven Project Object
|
private java.io.File |
projectsDirectory
Directory to search for integration tests.
|
private java.util.Map<java.lang.String,java.lang.String> |
properties
Common set of properties to pass in on each project's command line, via -D parameters.
|
private java.io.File |
reportsDirectory
Base directory where all build reports are written to.
|
private static int |
RESULT_COLUMN
The zero-based column index where to print the invoker result.
|
private org.apache.maven.shared.scriptinterpreter.ScriptRunner |
scriptRunner
The scripter runner that is responsible to execute hook scripts.
|
private java.util.Map<java.lang.String,java.lang.String> |
scriptVariables
Additional variables for use in the hook scripts.
|
private java.text.DecimalFormat |
secFormat
The format for elapsed build time.
|
private java.lang.String |
selectorScript
Relative path of a selector script to run prior in order to decide if the build should be executed.
|
private org.apache.maven.execution.MavenSession |
session |
private org.apache.maven.settings.Settings |
settings
The current user system settings for use in Maven.
|
private org.apache.maven.settings.building.SettingsBuilder |
settingsBuilder |
private java.io.File |
settingsFile
Path to an alternate
settings.xml to use for Maven invocation with all ITs. |
private java.util.List<java.lang.String> |
setupIncludes
Include patterns for searching the projects directory for projects that need to be run before the other projects.
|
private boolean |
showErrors
Whether to show errors in the build output.
|
private boolean |
showVersion
flag to enable show mvn version used for running its (cli option : -V,--show-version )
|
private boolean |
skipInvocation
Flag used to suppress certain invocations.
|
private boolean |
streamLogs
Flag used to determine whether the build logs should be output to the normal mojo log.
|
protected boolean |
suppressSummaries
Flag used to suppress the summary output notifying of successes and failures.
|
private java.util.List<java.lang.String> |
testClassPath
The test class path of the project under test.
|
private java.lang.String |
testPropertiesFile
Location of a properties file that defines CLI properties for the test.
|
private int |
timeoutInSeconds |
private org.apache.maven.toolchain.ToolchainManagerPrivate |
toolchainManagerPrivate |
Constructor and Description |
---|
AbstractInvokerMojo() |
Modifier and Type | Method and Description |
---|---|
(package private) static boolean |
alreadyCloned(java.lang.String subpath,
java.util.List<java.lang.String> clonedSubpaths)
Determines whether the specified sub path has already been cloned, i.e.
|
(package private) void |
buildInterpolatedFile(java.io.File originalFile,
java.io.File interpolatedFile)
Interpolates the specified POM/settings file to a temporary file.
|
private java.util.List<java.lang.String> |
calculateExcludes() |
private void |
cloneProjects(java.util.Collection<java.lang.String> projectPaths)
Copies the specified projects to the directory given by
cloneProjectsTo . |
private org.apache.maven.settings.Settings |
cloneSettings() |
private java.util.List<java.lang.String> |
collectListFromCSV(java.lang.String csv)
Gets a list of comma separated tokens from the specified line.
|
private void |
collectProjects(java.io.File projectsDir,
java.lang.String projectPath,
java.util.Collection<java.lang.String> projectPaths,
boolean included)
Collects all projects locally reachable from the specified project.
|
private void |
copyDirectoryStructure(java.io.File sourceDir,
java.io.File destDir)
Copied a directory structure with default exclusions (.svn, CVS, etc)
|
private void |
deleteInterpolatedPomFile(java.io.File interpolatedPomFile)
Delete the interpolated pom file if it has been created before.
|
protected void |
doFailIfNoProjects() |
void |
execute()
Invokes Maven on the configured test projects.
|
private java.lang.String |
formatTime(double seconds)
Formats the specified build duration time.
|
private java.nio.file.Path |
getAncestorFolder(java.nio.file.Path p) |
(package private) BuildJob[] |
getBuildJobs()
Gets the build jobs that should be processed.
|
(package private) java.util.List<java.lang.String> |
getGoals(java.io.File basedir)
Gets the goal list for the specified project.
|
private java.util.Map<java.lang.String,java.lang.Object> |
getInterpolationValueSource(boolean escapeXml)
Returns the map-based value source used to interpolate POMs and other stuff.
|
private InvokerProperties |
getInvokerProperties(java.io.File projectDirectory,
java.util.Properties globalInvokerProperties)
Gets the (interpolated) invoker properties for an integration test.
|
private BuildJob[] |
getNonSetupJobs(BuildJob[] buildJobs) |
private java.lang.String |
getParentPath(java.lang.String path)
Gets the parent path of the specified relative path.
|
(package private) java.util.List<java.lang.String> |
getProfiles(java.io.File basedir)
Gets the profile list for the specified project.
|
private int |
getSelection(InvokerProperties invokerProperties,
java.lang.CharSequence actualJreVersion)
Determines whether selector conditions of the specified invoker properties match the current environment.
|
private BuildJob[] |
getSetupBuildJobsFromFolders() |
private java.util.Properties |
getSystemProperties(java.io.File basedir,
java.lang.String filename)
Gets the system properties to use for the specified project.
|
private java.util.List<java.lang.String> |
getTokens(java.io.File basedir,
java.lang.String filename,
java.util.List<java.lang.String> defaultTokens)
Gets goal/profile names for the specified project, either directly from the plugin configuration or from an
external token file.
|
private AbstractInvokerMojo.ToolchainPrivateManager |
getToolchainPrivateManager() |
private void |
handleScriptRunnerWithScriptClassPath() |
private java.io.File |
interpolatePomFile(java.io.File pomFile,
java.io.File basedir)
Interpolate the pom file.
|
private java.io.File |
interpolateSettings(java.io.File settingsFile)
Interpolate settings.xml file.
|
protected boolean |
isParallelRun() |
private java.io.File |
mergeSettings(java.io.File interpolatedSettingsFile)
Merge the settings file
|
private java.io.Reader |
newReader(java.io.File file)
Creates a new reader for the specified file, using the plugin's
encoding parameter. |
private org.apache.maven.shared.utils.logging.MessageBuilder |
pad(BuildJob buildJob) |
(package private) abstract void |
processResults(InvokerSession invokerSession)
Processes the results of invoking the build jobs.
|
private java.util.List<java.lang.String> |
readTokens(java.io.File tokenFile)
Reads the tokens from the specified file.
|
private java.lang.String |
relativizePath(java.io.File path,
java.lang.String basedir)
Relativizes the specified path against the given base directory.
|
private void |
relativizeProjectPaths(BuildJob[] buildJobs)
Relativizes the project paths of the specified build jobs against the directory specified by
projectsDirectory (if possible). |
private void |
resetSourceLevelSet(org.apache.maven.settings.TrackableBase trackable) |
private java.lang.CharSequence |
resolveExternalJreVersion() |
private void |
runBuild(java.io.File projectsDir,
BuildJob buildJob,
java.io.File settingsFile,
java.io.File actualJavaHome,
java.lang.CharSequence actualJreVersion,
java.util.Properties globalInvokerProperties)
Runs the specified project.
|
private boolean |
runBuild(java.io.File basedir,
java.io.File pomFile,
java.io.File settingsFile,
java.io.File actualJavaHome,
InvokerProperties invokerProperties)
Runs the specified project.
|
private void |
runBuilds(java.io.File projectsDir,
BuildJob[] buildJobs,
int runWithParallelThreads)
Runs the specified build jobs.
|
private void |
runPostBuildHook(java.io.File basedir,
java.util.Map<java.lang.String,java.lang.Object> context,
FileLogger logger) |
private BuildJob[] |
scanProjectsDirectory(java.util.List<java.lang.String> includes,
java.util.List<java.lang.String> excludes,
java.lang.String type)
Scans the projects directory for projects to build.
|
private FileLogger |
setupBuildLogFile(java.io.File basedir)
Initializes the build logger for the specified project.
|
private void |
setupLoggerForBuildJob(FileLogger logger,
org.apache.maven.shared.invoker.InvocationRequest request) |
private void |
setupReportsFolder()
This will create the necessary folders for the reports.
|
private static java.lang.String |
toUrl(java.lang.String filename)
Converts the specified filesystem path to a URL.
|
private void |
verify(org.apache.maven.shared.invoker.InvocationResult result,
int invocationIndex,
InvokerProperties invokerProperties,
FileLogger logger)
Verifies the invocation result.
|
private void |
writeBuildReport(BuildJob buildJob)
Writes the XML report for the specified build job unless report generation has been disabled.
|
private java.io.File |
writeMergedSettingsFile(org.apache.maven.settings.Settings mergedSettings) |
private void |
writeSummaryFile(BuildJob[] buildJobs) |
private static final int RESULT_COLUMN
@Parameter(property="invoker.skip", defaultValue="false") private boolean skipInvocation
@Parameter(defaultValue="false") protected boolean suppressSummaries
true
, the
only indication of the build's success or failure will be the effect it has on the main build (if it fails, the
main build should fail as well). If streamLogs
is enabled, the sub-build summary will also provide an
indication.@Parameter(property="invoker.streamLogs", defaultValue="false") private boolean streamLogs
@Parameter(property="invoker.localRepositoryPath", defaultValue="${settings.localRepository}") private java.io.File localRepositoryPath
${project.build.directory}/it-repo
. Otherwise, your ordinary local repository will
be used, potentially soiling it with broken artifacts.@Parameter(property="invoker.projectsDirectory", defaultValue="${basedir}/src/it/") private java.io.File projectsDirectory
@Parameter(property="invoker.reportsDirectory", defaultValue="${project.build.directory}/invoker-reports") private java.io.File reportsDirectory
@Parameter(property="invoker.disableReports", defaultValue="false") private boolean disableReports
@Parameter(property="invoker.cloneProjectsTo") private java.io.File cloneProjectsTo
null
, each integration test
will be run in the directory in which the corresponding IT POM was found. In this case, you most likely want to
configure your SCM to ignore target
and build.log
in the test's base directory.@Parameter(defaultValue="false") private boolean cloneAllFiles
.svn
, CVS
,
*~
, etc: see
reference for full list). Setting this parameter to true
will cause all files to be copied to
the cloneProjectsTo
directory.@Parameter(defaultValue="true") private boolean cloneClean
cloneProjectsTo
directory is not polluted with files from earlier invoker runs.@Parameter(property="invoker.pom") private java.io.File pom
@Parameter private java.util.List<java.lang.String> pomIncludes
pom.xml
files one
directory below projectsDirectory
(i.e. */pom.xml
).*
will run Maven builds on all immediate sub directories of projectsDirectory
,
regardless if they contain a pom.xml
. This allows to perform builds that need/should not depend on
the existence of a POM.@Parameter private java.util.List<java.lang.String> pomExcludes
*
, the
custom settings file specified by the parameter settingsFile
will always be excluded automatically.@Parameter private java.util.List<java.lang.String> setupIncludes
pomExcludes
apply to the setup projects, too. Default
value is: setup*/pom.xml
.@Parameter private java.util.List<java.lang.String> goals
package
.@Component private org.apache.maven.shared.invoker.Invoker invoker
@Component private org.apache.maven.settings.building.SettingsBuilder settingsBuilder
@Component private org.apache.maven.toolchain.ToolchainManagerPrivate toolchainManagerPrivate
@Parameter(property="invoker.selectorScript", defaultValue="selector") private java.lang.String selectorScript
selector
),
the plugin searches for the file by trying out the well-known extensions .bsh
and
.groovy
. If this script exists for a particular project but returns any non-null value different
from true
, the corresponding build is flagged as skipped. In this case, none of the pre-build hook
script, Maven nor the post-build hook script will be invoked. If this script throws an exception, the
corresponding build is flagged as in error, and none of the pre-build hook script, Maven not the post-build hook
script will be invoked.@Parameter(property="invoker.preBuildHookScript", defaultValue="prebuild") private java.lang.String preBuildHookScript
prebuild
), the plugin
searches for the file by trying out the well-known extensions .bsh
and .groovy
. If this
script exists for a particular project but returns any non-null value different from true
or throws
an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build
hook script will be invoked.@Parameter(property="invoker.postBuildHookScript", defaultValue="postbuild") private java.lang.String postBuildHookScript
verify
), the
plugin searches for the file by trying out the well-known extensions .bsh
and .groovy
.
If this script exists for a particular project but returns any non-null value different from true
or
throws an exception, the corresponding build is flagged as a failure.@Parameter(property="invoker.testPropertiesFile", defaultValue="test.properties") private java.lang.String testPropertiesFile
@Parameter private java.util.Map<java.lang.String,java.lang.String> properties
@Parameter(property="invoker.showErrors", defaultValue="false") private boolean showErrors
@Parameter(property="invoker.debug", defaultValue="false") private boolean debug
@Parameter(property="invoker.noLog", defaultValue="false") private boolean noLog
build.log
file.@Parameter private java.io.File logDirectory
build.log
is created in the root of the project. By setting this folder
files are written to a different folder, respecting the structure of the projectsDirectory.@Parameter private java.util.List<java.lang.String> profiles
@Parameter private java.util.Map<java.lang.String,java.lang.String> filterProperties
@Parameter(defaultValue="${project}", readonly=true, required=true) private org.apache.maven.project.MavenProject project
@Parameter(defaultValue="${session}", readonly=true, required=true) private org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="${mojoExecution}", readonly=true, required=true) private org.apache.maven.plugin.MojoExecution mojoExecution
@Parameter(property="invoker.test") private java.lang.String invokerTest
setupIncludes
, pomIncludes
and pomExcludes
parameters. Each
pattern you specify here will be used to create an include/exclude pattern formatted like
${projectsDirectory}/pattern
. To exclude a test, prefix the pattern with a '!
'.
So you can just type -Dinvoker.test=SimpleTest,Comp*Test,!Compare*
${projectsDirectory}/SimpleTest
and ${projectsDirectory}/ComplexTest
, but not
${projectsDirectory}/CompareTest
@Parameter(property="invoker.settingsFile") private java.io.File settingsFile
settings.xml
to use for Maven invocation with all ITs. Note that the
<localRepository>
element of this settings file is always ignored, i.e. the path given by the
parameter localRepositoryPath
is dominant.@Parameter(property="invoker.mavenOpts") private java.lang.String mavenOpts
MAVEN_OPTS
environment variable to use when invoking Maven. This value can be overridden for
individual integration tests by using invokerPropertiesFile
.@Parameter(property="invoker.mavenHome") private java.io.File mavenHome
@Parameter(property="invoker.mavenExecutable") private java.lang.String mavenExecutable
${maven.home}/bin/
or an absolute file.Invoker.setMavenExecutable(File)
@Parameter(property="invoker.javaHome") private java.io.File javaHome
JAVA_HOME
environment variable to use for forked Maven invocations. Defaults to the current Java
home directory.@Parameter(property="encoding", defaultValue="${project.build.sourceEncoding}") private java.lang.String encoding
@Parameter(defaultValue="${settings}", readonly=true, required=true) private org.apache.maven.settings.Settings settings
@Parameter(property="invoker.addTestClassPath", defaultValue="false") private boolean addTestClassPath
false
, the class path of script interpreter consists only of the
runtime dependencies of the Maven Invoker Plugin. If set the true
,
the project's test class path will be prepended to the interpreter class path. Among others, this feature allows
the scripts to access utility classes from the test sources of your project.@Parameter(defaultValue="${project.testClasspathElements}", readonly=true) private java.util.List<java.lang.String> testClassPath
@Parameter(property="invoker.invokerPropertiesFile", defaultValue="invoker.properties") private java.lang.String invokerPropertiesFile
${project.version}
to reference project properties or values from the parameter
filterProperties
.
As of 3.2.0 it is possible to put this folder in any of the ancestor folders, where properties will be inherited. This way you can provide a single properties file for a group of projects
The snippet below describes the supported properties:
# A comma or space separated list of goals/phases to execute, may
# specify an empty list to execute the default goal of the IT project.
# Environment variables used by maven plugins can be added here
invoker.goals = clean install -Dplugin.variable=value
# Or you can give things like this if you need.
invoker.goals = -T2 clean verify
# Optionally, a list of goals to run during further invocations of Maven
invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
# A comma or space separated list of profiles to activate
invoker.profiles = its,jdk15
# The path to an alternative POM or base directory to invoke Maven on, defaults to the
# project that was originally specified in the plugin configuration
# Since plugin version 1.4
invoker.project = sub-module
# The value for the environment variable MAVEN_OPTS
invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
# Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
invoker.failureBehavior = fail-never
# The expected result of the build, possible values are "success" (default) and "failure"
invoker.buildResult = failure
# A boolean value controlling the aggregator mode of Maven, defaults to "false"
invoker.nonRecursive = true
# A boolean value controlling the network behavior of Maven, defaults to "false"
# Since plugin version 1.4
invoker.offline = true
# The path to the properties file from which to load system properties, defaults to the
# filename given by the plugin parameter testPropertiesFile
# Since plugin version 1.4
invoker.systemPropertiesFile = test.properties
# An optional human friendly name for this build job to be included in the build reports.
# Since plugin version 1.4
invoker.name = Test Build 01
# An optional description for this build job to be included in the build reports.
# Since plugin version 1.4
invoker.description = Checks the support for build reports.
# A comma separated list of JRE versions on which this build job should be run.
# Since plugin version 1.4
invoker.java.version = 1.4+, !1.4.1, 1.7-
# A comma separated list of OS families on which this build job should be run.
# Since plugin version 1.4
invoker.os.family = !windows, unix, mac
# A comma separated list of Maven versions on which this build should be run.
# Since plugin version 1.5
invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
# A mapping for toolchain to ensure it exists
# Since plugin version 3.2.0
invoker.toolchain.<type>.<provides> = value
invoker.toolchain.jdk.version = 11
# For java.version, maven.version, os.family and toolchain it is possible to define multiple selectors.
# If one of the indexed selectors matches, the test is executed.
# With the invoker.x.y equivalents you can specify global matchers.
selector.1.java.version = 1.8+
selector.1.maven.version = 3.2.5+
selector.1.os.family = !windows
selector.2.maven.version = 3.0+
selector.3.java.version = 9+
# A boolean value controlling the debug logging level of Maven, , defaults to "false"
# Since plugin version 1.8
invoker.debug = true
# Path to an alternate settings.xml
to use for Maven invocation with this IT.
# Since plugin version 3.0.1
invoker.settingsFile = ../
@Parameter(property="invoker.showVersion", defaultValue="false") private boolean showVersion
@Parameter(property="invoker.parallelThreads", defaultValue="1") private int parallelThreads
@Parameter(property="plugin.artifacts", required=true, readonly=true) private java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
@Parameter(property="invoker.mergeUserSettings", defaultValue="false") private boolean mergeUserSettings
@Parameter private java.util.Map<java.lang.String,java.lang.String> environmentVariables
@Parameter private java.util.Map<java.lang.String,java.lang.String> scriptVariables
@Parameter(defaultValue="0", property="invoker.timeoutInSeconds") private int timeoutInSeconds
private org.apache.maven.shared.scriptinterpreter.ScriptRunner scriptRunner
private java.lang.String filteredPomPrefix
null
. This will be set to
null
if the POMs have already been filtered during cloning.private final java.text.DecimalFormat secFormat
private java.lang.String actualMavenVersion
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
- If the goal encountered severe errors.org.apache.maven.plugin.MojoFailureException
- If any of the Maven builds failed.private void setupReportsFolder() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
- in case of failure during creation of the reports folder.private void handleScriptRunnerWithScriptClassPath()
private void writeSummaryFile(BuildJob[] buildJobs) throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException
protected void doFailIfNoProjects() throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureException
abstract void processResults(InvokerSession invokerSession) throws org.apache.maven.plugin.MojoFailureException
invokerSession
- The session with the build jobs, must not be null
.org.apache.maven.plugin.MojoFailureException
- If the mojo had failed as a result of invoking the build jobs.private java.io.Reader newReader(java.io.File file) throws java.io.IOException
encoding
parameter.file
- The file to create a reader for, must not be null
.null
.java.io.IOException
- If the specified file was not found or the configured encoding is not supported.private void collectProjects(java.io.File projectsDir, java.lang.String projectPath, java.util.Collection<java.lang.String> projectPaths, boolean included) throws org.apache.maven.plugin.MojoExecutionException
projectsDir
- The base directory of all projects, must not be null
.projectPath
- The relative path of the current project, can denote either the POM or its base directory,
must not be null
.projectPaths
- The set of already collected projects to add new projects to, must not be null
.
This set will hold the relative paths to either a POM file or a project base directory.included
- A flag indicating whether the specified project has been explicitly included via the parameter
pomIncludes
. Such projects will always be added to the result set even if there is no
corresponding POM.org.apache.maven.plugin.MojoExecutionException
- If the project tree could not be traversed.private void cloneProjects(java.util.Collection<java.lang.String> projectPaths) throws org.apache.maven.plugin.MojoExecutionException
cloneProjectsTo
. A project may either be denoted
by a path to a POM file or merely by a path to a base directory. During cloning, the POM files will be filtered.projectPaths
- The paths to the projects to clone, relative to the projects directory, must not be
null
nor contain null
elements.org.apache.maven.plugin.MojoExecutionException
- If the the projects could not be copied/filtered.private java.lang.String getParentPath(java.lang.String path)
path
- The relative path whose parent should be retrieved, must not be null
.null
.private void copyDirectoryStructure(java.io.File sourceDir, java.io.File destDir) throws java.io.IOException
sourceDir
- The source directory to copy, must not be null
.destDir
- The target directory to copy to, must not be null
.java.io.IOException
- If the directory structure could not be copied.static boolean alreadyCloned(java.lang.String subpath, java.util.List<java.lang.String> clonedSubpaths)
subpath
- The sub path to check, must not be null
.clonedSubpaths
- The list of already cloned paths, must not be null
nor contain
null
elements.true
if the specified path has already been cloned, false
otherwise.private void runBuilds(java.io.File projectsDir, BuildJob[] buildJobs, int runWithParallelThreads) throws org.apache.maven.plugin.MojoExecutionException
projectsDir
- The base directory of all projects, must not be null
.buildJobs
- The build jobs to run must not be null
nor contain null
elements.org.apache.maven.plugin.MojoExecutionException
- If any build could not be launched.private java.nio.file.Path getAncestorFolder(java.nio.file.Path p)
private java.io.File interpolateSettings(java.io.File settingsFile) throws org.apache.maven.plugin.MojoExecutionException
settingsFile
- a settings fileorg.apache.maven.plugin.MojoExecutionException
- in case of a problem.private java.io.File mergeSettings(java.io.File interpolatedSettingsFile) throws org.apache.maven.plugin.MojoExecutionException
interpolatedSettingsFile
- The interpolated settings file.org.apache.maven.plugin.MojoExecutionException
- Fail the build in case the merged settings file can't be created.private java.io.File writeMergedSettingsFile(org.apache.maven.settings.Settings mergedSettings) throws java.io.IOException
java.io.IOException
private org.apache.maven.settings.Settings cloneSettings()
private void resetSourceLevelSet(org.apache.maven.settings.TrackableBase trackable)
private java.lang.CharSequence resolveExternalJreVersion()
private java.io.File interpolatePomFile(java.io.File pomFile, java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
pomFile
- The pom file.basedir
- The base directory.org.apache.maven.plugin.MojoExecutionException
private void runBuild(java.io.File projectsDir, BuildJob buildJob, java.io.File settingsFile, java.io.File actualJavaHome, java.lang.CharSequence actualJreVersion, java.util.Properties globalInvokerProperties) throws org.apache.maven.plugin.MojoExecutionException
projectsDir
- The base directory of all projects, must not be null
.buildJob
- The build job to run, must not be null
.settingsFile
- The (already interpolated) user settings file for the build, may be null
to use
the current user settings.globalInvokerProperties
- org.apache.maven.plugin.MojoExecutionException
- If the project could not be launched.private org.apache.maven.shared.utils.logging.MessageBuilder pad(BuildJob buildJob)
private void deleteInterpolatedPomFile(java.io.File interpolatedPomFile)
interpolatedPomFile
- The interpolated pom file.private int getSelection(InvokerProperties invokerProperties, java.lang.CharSequence actualJreVersion)
invokerProperties
- The invoker properties to check, must not be null
.0
if the job corresponding to the properties should be run, otherwise a bitwise value
representing the reason why it should be skipped.private AbstractInvokerMojo.ToolchainPrivateManager getToolchainPrivateManager()
private void writeBuildReport(BuildJob buildJob) throws org.apache.maven.plugin.MojoExecutionException
buildJob
- The build job whose report should be written, must not be null
.org.apache.maven.plugin.MojoExecutionException
- If the report could not be written.private java.lang.String formatTime(double seconds)
seconds
- The duration of the build.null
.private boolean runBuild(java.io.File basedir, java.io.File pomFile, java.io.File settingsFile, java.io.File actualJavaHome, InvokerProperties invokerProperties) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.shared.scriptinterpreter.RunFailureException
basedir
- The base directory of the project, must not be null
.pomFile
- The (already interpolated) POM file, may be null
for a POM-less Maven invocation.settingsFile
- The (already interpolated) user settings file for the build, may be null
. Will
be merged with the settings file of the invoking Maven process.invokerProperties
- The properties to use.true
if the project was launched or false
if the selector script indicated that
the project should be skipped.org.apache.maven.plugin.MojoExecutionException
- If the project could not be launched.org.apache.maven.shared.scriptinterpreter.RunFailureException
- If either a hook script or the build itself
failed.private void runPostBuildHook(java.io.File basedir, java.util.Map<java.lang.String,java.lang.Object> context, FileLogger logger) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.shared.scriptinterpreter.RunFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.shared.scriptinterpreter.RunFailureException
private void setupLoggerForBuildJob(FileLogger logger, org.apache.maven.shared.invoker.InvocationRequest request)
private FileLogger setupBuildLogFile(java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
build.log
.basedir
- The base directory of the project, must not be null
.null
if logging has been disabled.org.apache.maven.plugin.MojoExecutionException
- If the log file could not be created.private java.util.Properties getSystemProperties(java.io.File basedir, java.lang.String filename) throws org.apache.maven.plugin.MojoExecutionException
basedir
- The base directory of the project, must not be null
.filename
- The filename to the properties file to load, may be null
to use the default path
given by testPropertiesFile
.null
.org.apache.maven.plugin.MojoExecutionException
- If the properties file exists but could not be read.private void verify(org.apache.maven.shared.invoker.InvocationResult result, int invocationIndex, InvokerProperties invokerProperties, FileLogger logger) throws org.apache.maven.shared.scriptinterpreter.RunFailureException
result
- The invocation result to check, must not be null
.invocationIndex
- The index of the invocation for which to check the exit code, must not be negative.invokerProperties
- The invoker properties used to check the exit code, must not be null
.logger
- The build logger, may be null
if logging is disabled.org.apache.maven.shared.scriptinterpreter.RunFailureException
- If the invocation result indicates a build
failure.java.util.List<java.lang.String> getGoals(java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
basedir
- The base directory of the project, must not be null
.null
.org.apache.maven.plugin.MojoExecutionException
- If the profile file could not be read.java.util.List<java.lang.String> getProfiles(java.io.File basedir) throws org.apache.maven.plugin.MojoExecutionException
basedir
- The base directory of the project, must not be null
.null
.org.apache.maven.plugin.MojoExecutionException
- If the profile file could not be read.private java.util.List<java.lang.String> calculateExcludes() throws java.io.IOException
java.io.IOException
private BuildJob[] getSetupBuildJobsFromFolders() throws java.io.IOException
java.io.IOException
#setupIncludes}
BuildJob[] getBuildJobs() throws java.io.IOException
null
.java.io.IOException
- If the projects directory could not be scanned.private BuildJob[] scanProjectsDirectory(java.util.List<java.lang.String> includes, java.util.List<java.lang.String> excludes, java.lang.String type) throws java.io.IOException
includes
- The include patterns for the scanner, may be null
.excludes
- The exclude patterns for the scanner, may be null
to exclude nothing.type
- The type to assign to the resulting build jobs, must not be null
.null
.java.io.IOException
- If the project directory could not be scanned.private void relativizeProjectPaths(BuildJob[] buildJobs) throws java.io.IOException
projectsDirectory
(if possible). If a project path does not denote a sub path of the projects directory,
it is returned as is.buildJobs
- The build jobs whose project paths should be relativized, must not be null
nor
contain null
elements.java.io.IOException
- If any path could not be relativized.private java.lang.String relativizePath(java.io.File path, java.lang.String basedir) throws java.io.IOException
path
- The path to relativize, must not be null
.basedir
- The (canonical path of the) base directory to relativize against, must not be null
.null
if the input path does not denote a sub path of the
base directory.java.io.IOException
- If the path could not be relativized.private java.util.Map<java.lang.String,java.lang.Object> getInterpolationValueSource(boolean escapeXml)
escapeXml
- true
, to escape any XML special characters in the property values; false
, to not
escape any property values.null
.private static java.lang.String toUrl(java.lang.String filename)
filename
- The filesystem path to convert, must not be null
.file:
URL for the specified path, never null
.private java.util.List<java.lang.String> getTokens(java.io.File basedir, java.lang.String filename, java.util.List<java.lang.String> defaultTokens) throws java.io.IOException
basedir
- The base directory of the test project, must not be null
.filename
- The (simple) name of an optional file in the project base directory from which to read
goals/profiles, may be null
.defaultTokens
- The list of tokens to return in case the specified token file does not exist, may be
null
.null
.java.io.IOException
- If the token file exists but could not be parsed.private java.util.List<java.lang.String> readTokens(java.io.File tokenFile) throws java.io.IOException
tokenFile
- The file to read the tokens from, must not be null
.null
.java.io.IOException
- If the token file could not be read.private java.util.List<java.lang.String> collectListFromCSV(java.lang.String csv)
csv
- The line with comma separated tokens, may be null
.null
.void buildInterpolatedFile(java.io.File originalFile, java.io.File interpolatedFile) throws org.apache.maven.plugin.MojoExecutionException
Note:This methods expects the file to be a XML file and applies special XML escaping during interpolation.
originalFile
- The XML file to interpolate, must not be null
.interpolatedFile
- The target file to write the interpolated contents of the original file to, must not be
null
.org.apache.maven.plugin.MojoExecutionException
- If the target file could not be created.private InvokerProperties getInvokerProperties(java.io.File projectDirectory, java.util.Properties globalInvokerProperties) throws org.apache.maven.plugin.MojoExecutionException
projectDirectory
- The base directory of the IT project, must not be null
.null
.org.apache.maven.plugin.MojoExecutionException
- If an I/O error occurred during reading the properties.protected boolean isParallelRun()