@Mojo(name="build-qualifier", defaultPhase=VALIDATE) public class BuildQualifierMojo extends AbstractVersionMojo
This mojo generates the build qualifier according to the rules described in the PDE documentation:
The generated qualifier is assigned to buildQualifier
project property. The
unqualified project version is assigned to unqualifiedVersion
project 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 property
qualifiedVersion
.
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> ...
Modifier and Type | Class and Description |
---|---|
(package private) static class |
BuildQualifierMojo.TychoProjectVersion |
Modifier and Type | Field and Description |
---|---|
protected java.io.File |
baseDir
Deprecated.
This parameter is deprecated and may be removed in future versions of Tycho.
|
protected BuildPropertiesParser |
buildPropertiesParser |
protected org.apache.maven.plugin.MojoExecution |
execution |
protected java.lang.String |
forceContextQualifier |
protected java.text.SimpleDateFormat |
format
Specify a date format as specified by java.text.SimpleDateFormat.
|
protected org.apache.maven.execution.MavenSession |
session |
protected java.lang.String |
timestampProvider
Role hint of a custom build timestamp provider.
|
protected java.util.Map<java.lang.String,BuildTimestampProvider> |
timestampProviders |
packaging, project, projectTypes
Constructor and Description |
---|
BuildQualifierMojo() |
Modifier and Type | Method and Description |
---|---|
private BuildQualifierMojo.TychoProjectVersion |
calculateQualifiedVersion() |
void |
execute() |
protected java.util.Date |
getBuildTimestamp() |
private org.osgi.framework.Version |
getParsedOSGiVersion() |
(package private) java.lang.String |
getQualifier(java.util.Date timestamp) |
private java.lang.String |
getUnqualifiedVersion() |
void |
setFormat(java.lang.String formatString) |
(package private) void |
validateQualifier(java.lang.String qualifier) |
getOSGiId, getOSGiVersion
@Parameter(property="session", readonly=true) protected org.apache.maven.execution.MavenSession session
@Parameter(defaultValue="yyyyMMddHHmm") protected java.text.SimpleDateFormat format
Specify a date format as specified by java.text.SimpleDateFormat. Timezone used is UTC.
@Deprecated @Parameter(property="project.basedir") protected java.io.File baseDir
@Parameter(property="forceContextQualifier") protected java.lang.String forceContextQualifier
@Parameter protected java.lang.String timestampProvider
Role hint of a custom build timestamp provider.
@Parameter(property="mojoExecution", readonly=true) protected org.apache.maven.plugin.MojoExecution execution
@Component protected BuildPropertiesParser buildPropertiesParser
@Component(role=BuildTimestampProvider.class) protected java.util.Map<java.lang.String,BuildTimestampProvider> timestampProviders
public void setFormat(java.lang.String formatString)
public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private BuildQualifierMojo.TychoProjectVersion calculateQualifiedVersion() throws org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoExecutionException
private org.osgi.framework.Version getParsedOSGiVersion() throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureException
void validateQualifier(java.lang.String qualifier) throws org.apache.maven.plugin.MojoFailureException
org.apache.maven.plugin.MojoFailureException
java.lang.String getQualifier(java.util.Date timestamp)
private java.lang.String getUnqualifiedVersion()
protected java.util.Date getBuildTimestamp() throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException