forked from Qortal/qortal
pom.xml modifications for reproducible builds
Seems to produce fat JARs with the same MD5 after repeated runs of: mvn clean package Needs testing on other platforms, hence this commit. Also trimmed some unneeded included JAR libraries from pom.xml, e.g. netty, async-http-client, and the *.js.map files from Swagger-UI, which seems to reduce output JAR size from about 51MB to about 44MB.
This commit is contained in:
parent
d2d2956c8a
commit
2af370d55d
92
pom.xml
92
pom.xml
@ -72,6 +72,37 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>4.0.0</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.commit.time$</includeOnlyProperty>
|
||||
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
|
||||
</includeOnlyProperties>
|
||||
<dateFormat>yyyyMMddHHmmss</dateFormat>
|
||||
<dateFormatTimeZone>UTC</dateFormatTimeZone>
|
||||
<gitDescribe>
|
||||
<dirty>-devel</dirty>
|
||||
</gitDescribe>
|
||||
<commitIdGenerationMode>full</commitIdGenerationMode>
|
||||
<injectAllReactorProjects>true</injectAllReactorProjects>
|
||||
<offline>true</offline>
|
||||
<skipPoms>false</skipPoms>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- inject correct url to swagger json file into swagger-ui -->
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
@ -79,12 +110,12 @@
|
||||
<version>1.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>replace-swagger-ui</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<file>${project.build.directory}/swagger-ui.unpacked/META-INF/resources/webjars/swagger-ui/${swagger-ui.version}/index.html</file>
|
||||
<replacements>
|
||||
@ -107,6 +138,27 @@
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>replace-git-resources</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
</goals>
|
||||
<inherited>false</inherited>
|
||||
<configuration>
|
||||
<file>${project.build.outputDirectory}/git.properties</file>
|
||||
<regex>true</regex>
|
||||
<regexFlags><regexFlag>MULTILINE</regexFlag></regexFlags>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>^(#.*$[\n\r]*)</token>
|
||||
<value></value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- add swagger-ui as resource to output package -->
|
||||
<plugin>
|
||||
@ -179,12 +231,18 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultEntries>false</addDefaultEntries>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Last-Commit-Id>${git.commit.id.full}</Last-Commit-Id>
|
||||
<Last-Commit-Time>${git.commit.time}</Last-Commit-Time>
|
||||
<Reproducible-Build>true</Reproducible-Build>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -208,6 +266,7 @@
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
<exclude>**/*.js.map</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
@ -234,6 +293,23 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.github.zlika</groupId>
|
||||
<artifactId>reproducible-build-maven-plugin</artifactId>
|
||||
<version>0.11</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<id>strip-jar</id>
|
||||
<goals>
|
||||
<goal>strip-jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<zipDateTime>${git.commit.time}</zipDateTime>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
@ -360,6 +436,16 @@
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-annotations</artifactId>
|
||||
</exclusion>
|
||||
<!-- exclude Netty, as included by io.druid.java.util -->
|
||||
<exclusion>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty</artifactId>
|
||||
</exclusion>
|
||||
<!-- exclude async-http-client, as included by io.druid.java.util -->
|
||||
<exclusion>
|
||||
<groupId>org.asynchttpclient</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- For NTP -->
|
||||
|
@ -1,2 +1,2 @@
|
||||
build.timestamp=${build.timestamp}
|
||||
build.version=${project.version}
|
||||
build.timestamp=${git.commit.time}
|
||||
build.version=${project.version}-${git.commit.id.abbrev}
|
||||
|
Loading…
x
Reference in New Issue
Block a user