Page tree

 

Build Points run the build point mojo at specified phases of the build process.

Build Points run the build point mojo at specified phases of the build process. With build points you can

  1. add custom providers at any point of the build. This is useful if certain information is not available at the start of the build when the buildmetadata-mojo is run.
  2. send build information to a backend system at any phase of the build.
  3. provide time measurements at specified build points.

Setting a Build Point

For each build point add an execution block to the plugin's section in the POM and bind it to the phase to run in. Providers that run with a build point require the property runAtBuildPoint set to true.

The following example shows how to set two sample build points.

Add the buildmetadata plugin artifact as a dependency.

<plugin>
  <groupId>de.smartics.maven.plugin</groupId>
  <artifactId>buildmetadata-maven-plugin</artifactId>
  <version>1.7.0</version>
    <inherited>true</inherited>
    <configuration>
      <providers>
        <provider>
          <type>de.smartics.sandbox.provider.InitProvider</type>
        </provider>
        <provider>
          <type>de.smartics.sandbox.provider.EchoProvider</type>
          <properties>
            <echo>Beautiful!</echo>
            <times>3</times>
            <runAtBuildPoint>true</runAtBuildPoint>
          </properties>
        </provider>
      </providers>
    </configuration>
    <executions>
      <execution>
        <id>build-point-1</id>
        <goals>
          <goal>build-point</goal>
        </goals>
        <phase>test</phase>
        <configuration>
          <name>test</name>
        </configuration>
      </execution>
      <execution>
        <id>build-point-2</id>
        <goals>
          <goal>build-point</goal>
        </goals>
        <phase>verify</phase>
        <configuration>
          <name>promote</name>
          <providers>
            <provider>
              <type>de.smartics.sandbox.provider.PromotionProvider</type>
              <properties>
                <runAtBuildPoint>true</runAtBuildPoint>
              </properties>
            </provider>
          </providers>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugin>

The InitProvider will not be run at any build point since its configuration lacks the runAtBuildPoint property. The EchoProvider is run at both build points. The PromotionProvider is only run at build-point-2 which is named promote in the verify phase.

For each build point the time within the build is logged as is the difference to the last build point (tagged with the diff suffix). The build properties file may contain the following information due to the build point configuration above.

build.duration.promote=20918
build.duration.promote.diff=41
build.duration.test=20877
build.duration.test.diff=20877

All times are given in milliseconds.

Please note that the properties are ordered by their name, not by the time in milliseconds.