mavenプロジェクトでGitソースコードを使用すると、mavenでビルドをコンパイルするたびに、gitとコミット番号の最後のコミットを読み取ることができます。gitとコミット番号の最後のコミットを読む
最後のコミットを見つけるために、そのコミット番号を使用します。
mavenプロジェクトでGitソースコードを使用すると、mavenでビルドをコンパイルするたびに、gitとコミット番号の最後のコミットを読み取ることができます。gitとコミット番号の最後のコミットを読む
最後のコミットを見つけるために、そのコミット番号を使用します。
これは、その情報を読み取り、それをプロパティファイルに格納することを前提としています。 https://github.com/ktoso/maven-git-commit-id-plugin#using-the-pluginに基づいて :
のpom.xml:SRC /メイン/リソース/中
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- snip other stuff... -->
<build>
<!-- GIT COMMIT ID PLUGIN CONFIGURATION -->
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<commitIdGenerationMode>flat</commitIdGenerationMode>
<gitDescribe>
<skip>true</skip>
</gitDescribe>
</configuration>
</plugin>
<!-- END OF GIT COMMIT ID PLUGIN CONFIGURATION -->
<!-- other plugins -->
</plugins>
</build>
</project>
git.properties:
git.commit.id=${git.commit.id}
あなたはいくつかの他の間でのGitをサポートmaven-buildnumber-pluginを、使用することができますSCMシステム。など、短いハッシュを使用し、
をSCMのブランチを把握、タイムスタンプを追加します。また、ちょうどリビジョンを取得以外に、独自のビルド番号を生成に関連する追加機能があり/ IDをコミット