Skip to content

Conversation

@TheSnoozer
Copy link
Collaborator

Context

This MR is a follow up to #414 and includes the following:

  • an additional cache check for the git.build.host to avoid unnecessary calls to InetAddress.getLocalHost().getHostName() which might be costly in a multi reactor build with many modules.
  • ensure caching is working correctly if we are building a reactor projects with injectAllReactorProjects=true and also specify multiple execution with a different prefix for the plugin

Essentially the following in a multi reactor build and injectAllReactorProjects=true:

<plugin>
   <groupId>pl.project13.maven</groupId>
   <artifactId>git-commit-id-plugin</artifactId>
   <version>${git-commit-id-version}</version>
   <executions>
      <execution>
         <phase>initialize</phase>
         <id>get-the-git-infos-for-repository-one</id>
         <goals>
            <goal>revision</goal>
         </goals>
         <configuration>
            <prefix>git1</prefix>
            <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
            <generateGitPropertiesFilename>${project.build.outputDirectory}/repository_one_git.properties</generateGitPropertiesFilename>
         </configuration>
      </execution>
      <execution>
         <phase>initialize</phase>
         <id>get-the-git-infos-for-repository-two</id>
         <goals>
            <goal>revision</goal>
         </goals>
         <configuration>
            <prefix>git2</prefix>
            <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
            <generateGitPropertiesFilename>${project.build.outputDirectory}/repository_two_git.properties</generateGitPropertiesFilename>
         </configuration>
      </execution>
   </executions>
   <configuration>
      <prefix>git</prefix>
      <verbose>true</verbose>
      <skipPoms>false</skipPoms>
      <dotGitDirectory>${project.basedir}/../.git</dotGitDirectory>
      <injectAllReactorProjects>true</injectAllReactorProjects>
      <generateGitPropertiesFile>true</generateGitPropertiesFile>
      <evaluateOnCommit>HEAD</evaluateOnCommit>
      <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
   </configuration>
</plugin>

Contributor Checklist

  • Added relevant integration or unit tests to verify the changes
  • Update the Readme or any other documentation (including relevant Javadoc)
  • Ensured that tests pass locally: mvn clean package
  • Ensured that the code meets the current checkstyle coding style definition: mvn clean verify -Pcheckstyle -Dmaven.test.skip=true -B

TheSnoozer added 2 commits April 30, 2019 21:53
…skip for reactor projects with injectAllReactorProjects=true also works properly when a user specifies multiple execution with a different prefix
@TheSnoozer TheSnoozer added the bug label May 1, 2019
@TheSnoozer TheSnoozer added this to the 3.0 milestone May 1, 2019
@TheSnoozer TheSnoozer merged commit ff72bb2 into git-commit-id:master May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant