Skip to content

Commit

Permalink
#4 Make all jar contains SCM info
Browse files Browse the repository at this point in the history
  • Loading branch information
amosshi committed Dec 18, 2022
1 parent 15db101 commit 0c3ffa4
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 59 deletions.
58 changes: 0 additions & 58 deletions BinaryInternalsViewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,50 +64,6 @@

<plugins>

<!-- Git revision -->
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>${git-commit-id-maven-plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
</includeOnlyProperties>
<commitIdGenerationMode>full</commitIdGenerationMode>
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<attach>true</attach>
<addOutputDirectoryToResources>true</addOutputDirectoryToResources>
</configuration>
</plugin>

<!-- Copy dependencies libraries to Target folder -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -141,20 +97,6 @@
<classpathPrefix>libs/</classpathPrefix>
<mainClass>org.freeinternals.biv.Main</mainClass>
</manifest>
<manifestEntries>
<Build-Time>${maven.build.timestamp}</Build-Time>
</manifestEntries>

<manifestSections>
<manifestSection>
<name>Versions</name>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
<Implementation-SCM-Branch>${scmBranch}</Implementation-SCM-Branch>
</manifestEntries>
</manifestSection>
</manifestSections>
</archive>
</configuration>
</plugin>
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ Build the Source Code
* If not set use the export statements in the `build.sh` script
* Build Tool: `Apache Maven 3.5` or higher: because we are using the [Maven CI Friendly Versions](https://maven.apache.org/maven-ci-friendly.html) `${revision}` feature
* Build
* `mvn clean package install`
* Build via maven command
* `mvn clean package install`
* Build with Script
* `./build.sh` (Linux/MacOS/Windows Git Bash)
* `build.cmd` (Windows CMD)
Expand Down
68 changes: 68 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,74 @@
<build>
<plugins>

<!-- Generate git.properties -->
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>${git-commit-id-maven-plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
</includeOnlyProperties>
<commitIdGenerationMode>full</commitIdGenerationMode>
</configuration>
</plugin>

<!-- Add SCM versiont to manifest -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>${buildnumber-maven-plugin.version}</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
<attach>true</attach>
<addOutputDirectoryToResources>true</addOutputDirectoryToResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifestEntries>
<Build-Time>${maven.build.timestamp}</Build-Time>
</manifestEntries>

<manifestSections>
<manifestSection>
<name>Versions</name>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-SCM-Revision>${buildNumber}</Implementation-SCM-Revision>
<Implementation-SCM-Branch>${scmBranch}</Implementation-SCM-Branch>
</manifestEntries>
</manifestSection>
</manifestSections>
</archive>
</configuration>
</plugin>

<!-- Java Compiler Show Deprecation and Warnings -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down

0 comments on commit 0c3ffa4

Please sign in to comment.