public abstract class AbstractBuildMojo
extends org.apache.maven.plugin.AbstractMojo
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
addToFilters
Flag to indicate whether or not the generated properties file should be
added to the projects filters.
|
protected boolean |
createPropertiesReport
Flag to choose whether (
true) or not (false) the
build.properties file should be created. |
protected boolean |
createXmlReport
Flag to choose whether (
true) or not (false) the
XML report should be created. |
protected org.apache.maven.project.MavenProject |
project
The Maven project.
|
protected List<Property> |
properties
The list of a system properties or environment variables to be selected by
the user to include into the build meta data properties.
|
protected File |
propertiesOutputFile
The name of the properties file to write.
|
protected List<Provider> |
providers
The list of meta data providers to launch that contribute to the meta data.
|
protected org.apache.maven.execution.RuntimeInformation |
runtime
The runtime information of the Maven instance being executed for the build.
|
protected org.apache.maven.execution.MavenSession |
session
The Maven session instance.
|
protected File |
xmlOutputFile
The name of the XML report file to write.
|
| Constructor and Description |
|---|
AbstractBuildMojo() |
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
org.apache.maven.project.MavenProject |
getProject()
Returns the Maven project.
|
boolean |
isCreatePropertiesReport()
Returns the value for createPropertiesReport.
|
protected void |
provideBuildMetaData(Properties buildMetaDataProperties,
ScmInfo scmInfo,
List<Provider> providers,
boolean runAtEndOfBuild)
Adds the information as build properties for each provider.
|
void |
setCreatePropertiesReport(boolean createPropertiesReport)
Sets the value for createPropertiesReport.
|
void |
setProject(org.apache.maven.project.MavenProject project)
Sets the Maven project.
|
void |
setPropertiesOutputFile(File propertiesOutputFile)
Sets the name of the properties file to write.
|
void |
setSession(org.apache.maven.execution.MavenSession session)
Sets the Maven session.
|
protected void |
updateMavenEnvironment(Properties buildMetaDataProperties,
BuildPropertiesFileHelper helper)
Updates the Maven runtime with build properties.
|
protected org.apache.maven.project.MavenProject project
protected org.apache.maven.execution.MavenSession session
protected org.apache.maven.execution.RuntimeInformation runtime
protected File propertiesOutputFile
protected File xmlOutputFile
${project.build.outputDirectory}/META-INF/buildmetadata.xml.
The handling is not in an analogous manner as that of the properties file.
The reason is this: we want to keep the artifact as small as possible per
default. Therefore we include the build.properties and
generate the XML report (see property createXmlReport to the
target folder (and not inside META-INF). The XML file can be
stored to the artifact server (with a couple of other reports) by the use
of the
projectmetadata-maven-plugin.
protected boolean createPropertiesReport
true) or not (false) the
build.properties file should be created.
This will adjust the path of the propertiesOutputFile to
${project.build.directory}/build.properties.
protected boolean createXmlReport
true) or not (false) the
XML report should be created.protected List<Provider> providers
protected List<Property> properties
The name is the name of the property, the section is relevant for placing the property in one of the following sections:
build.scmbuild.dateAndVersionbuild.runtimebuild.javabuild.mavenprojectbuild.misc
If no valid section is given, the property is silently rendered in the
build.misc section.
protected boolean addToFilters
Filters are only added temporarily (read in-memory during the build) and are not written to the POM.
public final org.apache.maven.project.MavenProject getProject()
public final void setProject(org.apache.maven.project.MavenProject project)
project - the Maven project.public final void setSession(org.apache.maven.execution.MavenSession session)
Used for testing.
session - the Maven session.public final void setPropertiesOutputFile(File propertiesOutputFile)
Used for testing.
propertiesOutputFile - the name of the properties file to write.public boolean isCreatePropertiesReport()
Flag to choose whether (true) or not (false) the
build. properties file should be created.
This will adjust the path of the propertiesOutputFile to
${project.build.directory}/build.properties.
public void setCreatePropertiesReport(boolean createPropertiesReport)
Flag to choose whether (true) or not (false) the
build. properties file should be created.
This will adjust the path of the propertiesOutputFile to
${project.build.directory}/build.properties.
createPropertiesReport - the value for createPropertiesReport.public void execute()
throws org.apache.maven.plugin.MojoExecutionException,
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprotected final void provideBuildMetaData(Properties buildMetaDataProperties, ScmInfo scmInfo, List<Provider> providers, boolean runAtEndOfBuild) throws org.apache.maven.plugin.MojoExecutionException
buildMetaDataProperties - the build meta data properties to add to.scmInfo - the information for the SCM provided to the build plugin.providers - the providers to iterate over.runAtEndOfBuild - checks if the provider is configured to be run at
the end of the build. If a provider matches this value, it is run.org.apache.maven.plugin.MojoExecutionException - on any problem running on the providers.protected final void updateMavenEnvironment(Properties buildMetaDataProperties, BuildPropertiesFileHelper helper)
buildMetaDataProperties - the properties to add to the Maven project
properties.helper - the project helper to use.Copyright © 2006–2013. All rights reserved.