Class BuildQualifierMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.eclipse.tycho.buildversion.AbstractVersionMojo
-
- org.eclipse.tycho.buildversion.BuildQualifierMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
BuildQualifierAggregatorMojo
@Mojo(name="build-qualifier", defaultPhase=VALIDATE) public class BuildQualifierMojo extends AbstractVersionMojoThis mojo generates the build qualifier according to the rules described in the PDE documentation:
- Explicit -DforceContextQualifier command line parameter
- forceContextQualifier from ${project.baseDir}/build.properties
- A time stamp in the form YYYYMMDDHHMM (e.g. 200605121600)
The generated qualifier is assigned to
buildQualifierproject property. The unqualified project version is assigned tounqualifiedVersionproject property. The unqualified version is calculated based on${project.version}and can be used for any Tycho project and regular Maven project. Different projects can use different formats to expand the timestamp (not recommended). The concatenation of${unqualifiedVersion}and${buildQualifier}, if not empty, is assigned to the project propertyqualifiedVersion.The timestamp generation logic is extensible. The primary use case is to generate build version qualifier based on the timestamp of the last project commit. Here is example pom.xml snippet that enables custom timestamp generation logic
... <plugin> <groupId>org.eclipse.tycho</groupId> <artifactId>tycho-packaging-plugin</artifactId> <version>${tycho-version}</version> <dependencies> <dependency> <groupId>timestamp-provider-groupid</groupId> <artifactId>timestamp-provider-artifactid</artifactId> <version>timestamp-provider-version</version> </dependency> </dependencies> <configuration> <timestampProvider>custom</timestampProvider> </configuration> </plugin> ...
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classBuildQualifierMojo.TychoProjectVersion
-
Field Summary
Fields Modifier and Type Field Description protected java.io.FilebaseDirDeprecated.This parameter is deprecated and may be removed in future versions of Tycho.protected BuildPropertiesParserbuildPropertiesParserprotected org.apache.maven.plugin.MojoExecutionexecutionprotected java.lang.StringforceContextQualifierprotected java.text.SimpleDateFormatformatSpecify a date format as specified by java.text.SimpleDateFormat.protected org.apache.maven.execution.MavenSessionsessionprotected java.lang.StringtimestampProviderRole hint of a custom build timestamp provider.protected java.util.Map<java.lang.String,BuildTimestampProvider>timestampProviders-
Fields inherited from class org.eclipse.tycho.buildversion.AbstractVersionMojo
packaging, project, projectTypes
-
-
Constructor Summary
Constructors Constructor Description BuildQualifierMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private BuildQualifierMojo.TychoProjectVersioncalculateQualifiedVersion()voidexecute()protected java.util.DategetBuildTimestamp()private org.osgi.framework.VersiongetParsedOSGiVersion()(package private) java.lang.StringgetQualifier(java.util.Date timestamp)private java.lang.StringgetUnqualifiedVersion()voidsetFormat(java.lang.String formatString)(package private) voidvalidateQualifier(java.lang.String qualifier)-
Methods inherited from class org.eclipse.tycho.buildversion.AbstractVersionMojo
getOSGiId, getOSGiVersion
-
-
-
-
Field Detail
-
session
@Parameter(property="session", readonly=true) protected org.apache.maven.execution.MavenSession session
-
format
@Parameter(defaultValue="yyyyMMddHHmm") protected java.text.SimpleDateFormat format
Specify a date format as specified by java.text.SimpleDateFormat. Timezone used is UTC.
-
baseDir
@Deprecated @Parameter(property="project.basedir") protected java.io.File baseDir
Deprecated.This parameter is deprecated and may be removed in future versions of Tycho.
-
forceContextQualifier
@Parameter(property="forceContextQualifier") protected java.lang.String forceContextQualifier
-
timestampProvider
@Parameter protected java.lang.String timestampProvider
Role hint of a custom build timestamp provider.
- Since:
- 0.16.0
-
execution
@Parameter(property="mojoExecution", readonly=true) protected org.apache.maven.plugin.MojoExecution execution
-
buildPropertiesParser
@Component protected BuildPropertiesParser buildPropertiesParser
-
timestampProviders
@Component(role=BuildTimestampProvider.class) protected java.util.Map<java.lang.String,BuildTimestampProvider> timestampProviders
-
-
Method Detail
-
setFormat
public void setFormat(java.lang.String formatString)
-
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
-
calculateQualifiedVersion
private BuildQualifierMojo.TychoProjectVersion calculateQualifiedVersion() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
- Throws:
org.apache.maven.plugin.MojoFailureExceptionorg.apache.maven.plugin.MojoExecutionException
-
getParsedOSGiVersion
private org.osgi.framework.Version getParsedOSGiVersion() throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
validateQualifier
void validateQualifier(java.lang.String qualifier) throws org.apache.maven.plugin.MojoFailureException- Throws:
org.apache.maven.plugin.MojoFailureException
-
getQualifier
java.lang.String getQualifier(java.util.Date timestamp)
-
getUnqualifiedVersion
private java.lang.String getUnqualifiedVersion()
-
getBuildTimestamp
protected java.util.Date getBuildTimestamp() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
-