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 |
createManifestFile
Flag to choose whether (
true) or not (false) the
Manifest file should be created. |
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 File |
manifestFile
The location of the Manifest file to add the buildmetadata properties to.
|
protected String |
manifestSection
The name of the section within the Manifest file to write the
buildmetadata properties to.
|
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 String |
remoteVersion
The branch or tag version on the remote server to compare against.
|
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 SettingsDecrypter |
settingsDecrypter
Helper to decrypt passwords from the settings handling the location of the
settings-security.xml file. |
protected boolean |
writeProtectFiles
Flag to choose whether (
true) or not (false) to
write protect the generated buildmetadata files. |
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 File manifestFile
protected String manifestSection
Main" to write the the main
section.protected boolean createManifestFile
true) or not (false) the
Manifest file should be created.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 boolean writeProtectFiles
true) or not (false) to
write protect the generated buildmetadata files. Protecting them allows to
projects that copy files from different resources together to not override
them by other plugins.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.
protected String remoteVersion
For SVN, leave it blank. For Git, set the version on the remote server (the project's SCM URL points to).
protected SettingsDecrypter settingsDecrypter
settings-security.xml file.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) throws org.apache.maven.plugin.MojoExecutionException
buildMetaDataProperties - the properties to add to the Maven project
properties.helper - the project helper to use.org.apache.maven.plugin.MojoExecutionException - if a requested Manifest file cannot be
created.Copyright © 2006-2014. All Rights Reserved.