mojohaus / build-helper-maven-plugin

Build Helper Maven Plugin
https://www.mojohaus.org/build-helper-maven-plugin/
MIT License
111 stars 82 forks source link

Extension #196

Open delanym opened 7 months ago

delanym commented 7 months ago

I'm trying to set a property for the year to use in the license

  <licenses>
    <license>
      <name>Copyright © ${build.year} Millennial Technologies</name>
      <url>Stop the NPE</url>
    </license>
  </licenses>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.5.0</version>
        <configuration>
          <name>build.year</name>
          <pattern>yyyy</pattern>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

Its not working, and I noticed the plugin has no extension ability

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.5.0</version>
          <extensions>true</extensions>
        </plugin>

Half the stated goals https://www.mojohaus.org/build-helper-maven-plugin/ would not change in a session and need only be run once.

Can this ability be added?

slawekjaranowski commented 4 months ago

@delanym do you think about: build-helper:timestamp-property - https://www.mojohaus.org/build-helper-maven-plugin/timestamp-property-mojo.html

It is not a report goal so should be in plugins sections not reporting

slawekjaranowski commented 4 months ago

I didn't test your case but afraid that can be complicated project pom in evaluated and properties are resolved at the beginning

plugins, reports are executed after parsing

delanym commented 4 months ago

I tried configuring this in build section but the property is not resolved in the license for the site

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>3.6.0</version>
          <executions>
            <execution>
              <id>year</id>
              <goals>
                <goal>timestamp-property</goal>
              </goals>
              <phase>validate</phase>
              <configuration>
                <name>build.year</name>
                <pattern>yyyy</pattern>
                <locale>en_ZA</locale>
              </configuration>
            </execution>
          </executions>
        </plugin>