Class CreateMetadataMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.codehaus.mojo.build.AbstractScmMojo
org.codehaus.mojo.build.CreateMetadataMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
@Mojo(name="create-metadata",
defaultPhase=GENERATE_RESOURCES,
requiresProject=true,
threadSafe=true)
public class CreateMetadataMojo
extends AbstractScmMojo
This mojo discovers latest SCM revision, current timestamp, project version, and project name then write them to one
or more java property files together with a set of user provided properties. It also has option to add the output
file to resource classpath for jar packaging.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanAdd outputDirectory to java resource so that outputName will be under runtime classpath.private StringApplication nameprivate StringJava property name to store the project nameprivate booleanInstall/Deploy to Maven repositoryprivate booleanEnable output format detection.private StringArtifact classifier name when deploying to Maven repositoryprivate FileOutput directoryAdditional output filesprivate StringOutput file nameprivate org.apache.maven.project.MavenProjectHelperMaven ProjectHelper.Additional properties to write outprivate StringJava property name to store the discovered SCM revision valueprivate Stringjava.text.SimpleDateFormat for the discover timestamp, if not given use long integer formatprivate StringJava property name to store the discovered timestamp valueprivate StringThe timezone of the generated timestamp.private StringVersionprivate StringJava property name to store the project versionFields inherited from class AbstractScmMojo
password, project, revisionOnScmFailure, scmConnectionUrl, scmDeveloperConnectionUrl, scmDirectory, scmManager, scmTag, settings, shortRevisionLength, skip, usernameFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()private voidwriteToFile(Properties props, File file) private voidwriteToFile(Properties props, File file, OutputFormat outputFormat) Methods inherited from class AbstractScmMojo
checkResult, getScmRepository, getScmRevision, infoMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
applicationName
Application name- Since:
- 1.4
-
applicationPropertyName
Java property name to store the project name- Since:
- 1.4
-
versionPropertyName
Java property name to store the project version- Since:
- 1.4
-
version
-
revisionPropertyName
Java property name to store the discovered SCM revision value- Since:
- 1.4
-
timestampPropertyName
Java property name to store the discovered timestamp value- Since:
- 1.4
-
timestampFormat
java.text.SimpleDateFormat for the discover timestamp, if not given use long integer format- Since:
- 1.4
-
timezone
The timezone of the generated timestamp. If blank will default toTimeZone.getDefault() -
outputDirectory
@Parameter(defaultValue="${project.build.directory}/generated/build-metadata", required=true) private File outputDirectoryOutput directory- Since:
- 1.4
-
outputName
Output file name- Since:
- 1.4
-
addOutputDirectoryToResources
@Parameter(defaultValue="false") private boolean addOutputDirectoryToResourcesAdd outputDirectory to java resource so that outputName will be under runtime classpath. outputName can contain '/'- Since:
- 1.4
-
attach
@Parameter(defaultValue="false") private boolean attachInstall/Deploy to Maven repository- Since:
- 1.4
-
classifier
Artifact classifier name when deploying to Maven repository- Since:
- 3.0
-
outputFiles
-
properties
-
autoDetectOutputFormat
@Parameter(defaultValue="false") private boolean autoDetectOutputFormatEnable output format detection. (Disabled per default for compatibility.)- Since:
- 3.0
-
projectHelper
@Component private org.apache.maven.project.MavenProjectHelper projectHelperMaven ProjectHelper.
-
-
Constructor Details
-
CreateMetadataMojo
public CreateMetadataMojo()
-
-
Method Details
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
writeToFile
private void writeToFile(Properties props, File file) throws org.apache.maven.plugin.MojoFailureException - Throws:
org.apache.maven.plugin.MojoFailureException
-
writeToFile
- Throws:
IOException
-
getRevision
- Throws:
org.apache.maven.plugin.MojoExecutionException
-