Page tree

 

This is a tip on using the buildmetadata-plugin with the maven-license-plugin.

This is a tip on using the buildmetadata-plugin with the maven-license-plugin.

To use the build.copyright.year property with the maven-license-plugin, the buildmetadata-plugin has to be run in the same build execution. Use the following tip to run the

license:format

goal successfully.

Configuration

The buildmetadata-maven-plugin is configured to run in the initialize phase.

<plugin>
  <groupId>de.smartics.maven.plugin</groupId>
  <artifactId>buildmetadata-maven-plugin</artifactId>
  <version>1.7.0</version>
  <executions>
    <execution>
      <phase>initialize</phase>
      <goals>
        <goal>provide-buildmetadata</goal>
      </goals>
    </execution>
  </executions>
</plugin>

The license plugin uses the copyright year property provided by the buildmetadata-plugin.

<plugin>
  <groupId>com.mycila.maven-license-plugin</groupId>
  <artifactId>maven-license-plugin</artifactId>
  <version>1.9.0</version>
  <configuration>
    ...
    <properties>
      <year>${build.copyright.year}</year>
    </properties>
    ...
</plugin>

Run the Build

Run the build by typing

mvn initialize license:format