Skip to content

Commit

Permalink
git-commit-id/git-commit-id-maven-plugin#535: add POC that allows to …
Browse files Browse the repository at this point in the history
…generate for all git-directories for a reactor-project
  • Loading branch information
TheSnoozer committed Jun 12, 2021
1 parent 8e2afc8 commit e1fa3cc
Showing 1 changed file with 101 additions and 0 deletions.
101 changes: 101 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<!--<git-commit-id-version>2.2.5</git-commit-id-version> -->
<git-commit-id-version>3.0.0</git-commit-id-version>
<sonar.projectVersion>${project.version}-${git.branch}</sonar.projectVersion>
<git-commit-plugin-prefix>git</git-commit-plugin-prefix>
</properties>

<dependencies>
Expand Down Expand Up @@ -80,6 +81,105 @@
</plugins>
</build>
<profiles>
<profile>
<id>setup-git-prefix-for-submodule</id>
<activation>
<file>
<exists>../pom.xml</exists>
</file>
</activation>
<properties>
<git-commit-plugin-prefix>git.${project.artifactId}</git-commit-plugin-prefix>
</properties>
</profile>
<profile>
<id>generate-git-props</id>
<activation>
<file>
<exists>${basedir}/.git</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>${git-commit-id-version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
<execution>
<id>validate-the-git-infos</id>
<goals>
<goal>validateRevision</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<prefix>${git-commit-plugin-prefix}</prefix>
<!-- <prefix>git.${project.artifactId}</prefix> -->
<skipPoms>false</skipPoms>
<verbose>false</verbose>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<injectAllReactorProjects>true</injectAllReactorProjects>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/${project.artifactId}_git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<echo>===========================================================================</echo>
<echo>Found .git-Folder assuming we need to generate git.properties!</echo>
<echo>Set prefix to: ${git-commit-plugin-prefix}</echo>
<echo>Set dotGitDirectory to: ${project.basedir}/.git</echo>
<echo>Set generateGitPropertiesFilename to: ${project.build.outputDirectory}/${project.artifactId}_git.properties</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>out-put-dynamic-property</id>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<source>
String prefix = project.properties.getProperty("git-commit-plugin-prefix")
System.out.println(
"Commit-Generated for " + project.artifactId + " : " +
project.properties.getProperty(prefix + ".commit.id")
)
</source>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>git-with-parent</id>
<build>
Expand Down Expand Up @@ -134,6 +234,7 @@
<target>
<echo>===========================================================================</echo>
<echo>git.commit.id.describe: ${git.commit.id.describe}</echo>
<echo>git.commit.id.describe: ${git.commit.id.describe}</echo>
<echo>git.commit.id.describe.withoutdirty: ${git.commit.id.describe.withoutdirty}</echo>
</target>
</configuration>
Expand Down

0 comments on commit e1fa3cc

Please sign in to comment.