git-commit-id-maven-plugin
Used in: 
components
- OverviewOverview
 - VersionsVersions
 - DependentsDependents
 - DependenciesDependencies
 
<dependency>
    <groupId>io.github.git-commit-id</groupId>
    <artifactId>git-commit-id-maven-plugin</artifactId>
    <version>9.0.2</version>
</dependency><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>9</version>
        <relativePath />
    </parent>
    <groupId>io.github.git-commit-id</groupId>
    <artifactId>git-commit-id-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>9.0.2</version>
    <name>Git Commit Id Maven Plugin</name>
    <url>https://github.com/git-commit-id/git-commit-id-maven-plugin</url>
    <description>
        This plugin makes basic repository information available through maven resources. This can be used to display
        "what version is this?" or "who has deployed this and when, from which branch?" information at runtime, making
        it easy to find things like "oh, that isn't deployed yet, I'll test it tomorrow" and making both testers and
        developers life easier. See https://github.com/git-commit-id/git-commit-id-maven-plugin
    </description>
    <prerequisites>
        <maven>[3.6.3,)</maven>
    </prerequisites>
    <licenses>
        <license>
            <name>GNU Lesser General Public License 3.0</name>
            <url>http://www.gnu.org/licenses/lgpl-3.0.txt</url>
        </license>
    </licenses>
    <scm>
        <url>git@github.com:git-commit-id/git-commit-id-maven-plugin.git</url>
        <connection>scm:git@github.com:git-commit-id/git-commit-id-maven-plugin</connection>
        <developerConnection>scm:git:git@github.com:git-commit-id/git-commit-id-maven-plugin.git</developerConnection>
        <tag>v9.0.2</tag>
    </scm>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <propertiesEncoding>UTF-8</propertiesEncoding>
        <project.build.outputTimestamp>1747939865</project.build.outputTimestamp>
        <java.target>11</java.target>
        <maven-plugin-api.version>3.9.6</maven-plugin-api.version>
        <maven-plugin-plugin.version>3.15.1</maven-plugin-plugin.version>
        <junit.version>5.12.2</junit.version>
        <mockito.version>5.18.0</mockito.version>
        <assertj.version>3.27.3</assertj.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>git-commit-id-plugin-core</artifactId>
                <version>6.0.0</version>
            </dependency>
            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.2</version>
                <optional>true</optional>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <!-- GIT COMMIT ID PLUGIN CONFIGURATION -->
        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
                <excludes>
                    <exclude>_git_*/**</exclude>
                    <exclude>README.md</exclude>
                </excludes>
            </testResource>
        </testResources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.4.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.4.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>${maven-plugin-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.21.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Override oss parent downgrades -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <arguments>-Pgpg</arguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>2.18.0</version>
                <configuration>
                    <!-- https://www.mojohaus.org/versions/versions-maven-plugin/examples/display-dependency-updates.html -->
                    <ignoredVersions>.*-M.*,.*-alpha.*</ignoredVersions>
                </configuration>
            </plugin>
            <!-- if you would like to run the git-commit-id-maven-plugin for your build, you could also include it here instead using a profile (see README.md) -->
            <!-- Setting built-in java compiler properties -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>${java.target}</release>
                    <compilerArgument>-Xlint:deprecation</compilerArgument>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <phase>process-classes</phase>
                    </execution>
                    <!--
                              <execution>
                                <id>generated-helpmojo</id>
                                <goals>
                                  <goal>helpmojo</goal>
                                </goals>
                                <configuration>
                                  <goalPrefix>git-commit-id</goalPrefix>
                                  <helpPackageName>pl.project13.maven</helpPackageName>
                                </configuration>
                              </execution>
                    -->
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <detectJavaApiLink>false</detectJavaApiLink>
                    <source>8</source>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- MAVEN -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven-plugin-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven-plugin-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>git-commit-id-plugin-core</artifactId>
        </dependency>
        <!-- plexus build -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-build-api</artifactId>
            <version>1.2.0</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <!-- dependencies to annotations -->
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven-plugin-plugin.version}</version>
            <scope>provided</scope><!-- annotations are needed only to build the plugin -->
        </dependency>
        <!-- Test stuff -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.19.0</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <!--to avoid complaints during tests -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>2.0.17</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
    <profiles>
        <profile>
            <id>gpg</id>
            <build>
                <plugins>
                    <!-- GPG -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>demo</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.github.git-commit-id</groupId>
                        <artifactId>git-commit-id-maven-plugin</artifactId>
                        <version>${project.version}</version>
                        <!-- optional to change the phases of the individual mojo's -->
                        <executions>
                            <execution>
                                <id>get-the-git-infos</id>
                                <goals>
                                    <goal>revision</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>validate-the-git-infos</id>
                                <goals>
                                    <goal>validateRevision</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <verbose>true</verbose>
                            <skip>false</skip>
                            <prefix>git</prefix>
                            <dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
                            <generateGitPropertiesFile>true</generateGitPropertiesFile>
                            <generateGitPropertiesFilename>target/testing.properties</generateGitPropertiesFilename>
                            <!-- <dateFormat>yyyy-MM-dd'T'HH:mm:ssXXX</dateFormat> -->
                            <dateFormatTimeZone>GMT-08:00</dateFormatTimeZone>
                            <useNativeGit>false</useNativeGit>
                            <abbrevLength>7</abbrevLength>
                            <format>properties</format>
                            <injectAllReactorProjects>true</injectAllReactorProjects>
                            <gitDescribe>
                                <skip>false</skip>
                                <always>false</always>
                                <abbrev>7</abbrev>
                                <match>*</match>
                                <dirty>-DEVEL</dirty>
                                <forceLongFormat>false</forceLongFormat>
                            </gitDescribe>
                            <excludeProperties>
                                <!-- <excludeProperty>git.commit.*</excludeProperty> -->
                                <excludeProperty>git.remote.origin.url</excludeProperty>
                            </excludeProperties>
                            <replacementProperties>
                                <replacementProperty>
                                    <property>git.branch</property>
                                    <propertyOutputSuffix>something</propertyOutputSuffix>
                                    <token>^([^\/]*)\/([^\/]*)$</token>
                                    <value>$1-$2</value>
                                    <transformationRules>
                                        <transformationRule>
                                            <apply>BEFORE</apply>
                                            <action>UPPER_CASE</action>
                                        </transformationRule>
                                    </transformationRules>
                                </replacementProperty>
                            </replacementProperties>
                            <failOnNoGitDirectory>false</failOnNoGitDirectory>
                            <failOnUnableToExtractRepoInfo>true</failOnUnableToExtractRepoInfo>
                            <!-- used in validateRevision -->
                            <validationProperties>
                                <validationProperty>
                                    <name>validating project version</name>
                                    <value>${project.version}</value>
                                    <!-- <shouldMatchTo>^[0-9\.]*$</shouldMatchTo> -->
                                    <shouldMatchTo><![CDATA[^.*(?<!-SNAPSHOT)$]]></shouldMatchTo>
                                </validationProperty>
                                <validationProperty>
                                    <name>validating git dirty</name>
                                    <value>${git.dirty}</value>
                                    <shouldMatchTo>false</shouldMatchTo>
                                </validationProperty>
                            </validationProperties>
                            <validationShouldFailIfNoMatch>true</validationShouldFailIfNoMatch>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>coveralls</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.jsonwebtoken.coveralls</groupId>
                        <artifactId>coveralls-maven-plugin</artifactId>
                        <version>4.4.1</version>
                        <!-- repo token is passed via -DrepoToken=yourcoverallsprojectrepositorytoken -->
                        <dependencies>
                            <!-- https://github.com/trautonen/coveralls-maven-plugin/issues/141 -->
                            <dependency>
                                <groupId>jakarta.xml.bind</groupId>
                                <artifactId>jakarta.xml.bind-api</artifactId>
                                <version>4.0.2</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.8.13</version>
                        <executions>
                            <execution>
                                <id>prepare-agent</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>checkstyle</id>
            <properties>
                <maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
                <!--  if you update the checkstyle version make sure you update the google_checks.xml inside the repository -->
                <checkstyle.version>10.13.0</checkstyle.version>
                <checkstyle.config.path>${basedir}/.github/.checkstyle</checkstyle.config.path>
            </properties>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-checkstyle-plugin</artifactId>
                            <version>${maven-checkstyle-plugin.version}</version>
                            <dependencies>
                                <dependency>
                                    <groupId>com.puppycrawl.tools</groupId>
                                    <artifactId>checkstyle</artifactId>
                                    <version>${checkstyle.version}</version>
                                </dependency>
                            </dependencies>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>${maven-checkstyle-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>validate</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <configuration>
                                    <configLocation>${checkstyle.config.path}/google_checks_checkstyle_${checkstyle.version}.xml</configLocation>
                                    <suppressionsLocation>${checkstyle.config.path}/checkstyle-suppressions.xml</suppressionsLocation>
                                    <propertyExpansion>
                                        samedir=${checkstyle.config.path}
                                        org.checkstyle.google.suppressionfilter.config=${checkstyle.config.path}/checkstyle-suppressions.xml
                                    </propertyExpansion>
                                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                                    <encoding>${project.reporting.outputEncoding}</encoding>
                                    <consoleOutput>true</consoleOutput>
                                    <violationSeverity>warning</violationSeverity>
                                    <failsOnError>true</failsOnError>
                                    <failOnViolation>true</failOnViolation>
                                    <linkXRef>false</linkXRef>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>clone-git-submodules</id>
            <activation>
                <file>
                    <missing>${basedir}/src/test/resources/README.md</missing>
                </file>
            </activation>
            <build>
                <plugins>
                    <!-- https://sumit-jha.medium.com/how-to-make-maven-release-plugin-work-with-git-submodules-917825a253f2 -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.5.0</version>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>clone git submodule</id>
                                <phase>initialize</phase>
                                <configuration>
                                    <executable>git</executable>
                                    <arguments>
                                        <argument>submodule</argument>
                                        <argument>update</argument>
                                        <argument>--init</argument>
                                        <argument>--recursive</argument>
                                    </arguments>
                                </configuration>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>