Class 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 AbstractVersionMojo

    This mojo generates the build qualifier according to the rules described in the PDE documentation:

    1. Explicit -DforceContextQualifier command line parameter
    2. forceContextQualifier from ${project.baseDir}/build.properties
    3. A time stamp in the form YYYYMMDDHHMM (e.g. 200605121600)

    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>
     ...
     
     
    • Field Detail

      • session

        @Parameter(property="session",
                   readonly=true)
        protected org.apache.maven.execution.MavenSession session
      • format

        @Parameter(defaultValue="yyyyMMddHHmm")
        protected SimpleDateFormat format

        Specify a date format as specified by java.text.SimpleDateFormat. Timezone used is UTC.

      • baseDir

        @Deprecated
        @Parameter(property="project.basedir")
        protected File baseDir
        Deprecated.
        This parameter is deprecated and may be removed in future versions of Tycho.
      • forceContextQualifier

        @Parameter(property="forceContextQualifier")
        protected String forceContextQualifier
      • timestampProvider

        @Parameter
        protected 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
    • Constructor Detail

      • BuildQualifierMojo

        public BuildQualifierMojo()
    • Method Detail

      • setFormat

        public void setFormat​(String formatString)
      • execute

        public void execute()
                     throws org.apache.maven.plugin.MojoExecutionException,
                            org.apache.maven.plugin.MojoFailureException
        Throws:
        org.apache.maven.plugin.MojoExecutionException
        org.apache.maven.plugin.MojoFailureException
      • getBuildTimestamp

        protected Date getBuildTimestamp()
                                  throws org.apache.maven.plugin.MojoExecutionException
        Throws:
        org.apache.maven.plugin.MojoExecutionException