added dependency management for all bouncycastle dependencies, these jar are signed and can not be placed in shaded jar, copy them in a lib directory that will be use by shaded.jar classloader

This commit is contained in:
cedric.walter 2017-07-08 21:03:13 +02:00
parent 5d05326991
commit 692bc1a837
3 changed files with 72 additions and 35 deletions

View file

@ -112,31 +112,7 @@ It is not needed for a normal user to run such a "full node" but for the build i
Prepare bisq build
-----------------
### 4. Get bisq source code and build a preliminary bisq version (don't run the jar, it wont work)
We need to get the bisq dependencies resolved first as we need to copy the BouncyCastle jar to the JRE directory.
$ git clone https://github.com/bitsquare/bitsquare.git
$ cd bisq
$ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
### 5. Copy the BouncyCastle provider jar file
Copy the BountyCastle provider jar file from the local maven repository to the jre/lib/ext directory.
This prevents a "JCE cannot authenticate the provider BC" exception when starting the bisq client.
$ sudo cp ~/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.53/bcprov-jdk15on-1.53.jar $JAVA_HOME/jre/lib/ext/
### 6. Edit the java.security file and add BouncyCastleProvider
Add org.bouncycastle.jce.provider.BouncyCastleProvider as last entry at: List of providers and their preference orders
E.g.:
security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider
$ sudo gedit $JAVA_HOME/jre/lib/security/java.security
... edit and save
### 7. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK)
### 1. Enable unlimited Strength for cryptographic keys (only required for Oracle JDK)
If you are using Oracle JDK 8 you must **[enable strong cryptographic cyphers](https://github.com/jonathancross/jc-docs/blob/master/java-strong-crypto-test/README.md)**. If you use OpenJDK + OpenJFX you can skip this step.
@ -146,13 +122,13 @@ In Windows the new crypto files need to be copied to `Java/jdk1.8.0_xxx/jre/lib/
Build bisq
-----------------
### 8. Build final bisq jar
### 2. Build final bisq jar
Now we have all prepared to build the correct bisq jar.
$ mvn clean package verify -DskipTests -Dmaven.javadoc.skip=true
When the build completes, you will find an executable jar: `gui/target/shaded.jar`.
When the build completes, you will find an executable jar: `gui/target/shaded.jar` and a ./lib directory.
To run it use:
$ java -jar gui/target/shaded.jar
@ -160,7 +136,7 @@ To run it use:
Build binaries
-----------------
If you want to build the binaries check out the build scripts under the package directory.
If you want to build the binaries check out the build scripts under the package directory. copy shaded.jar and the lib directory.
DAO full node

View file

@ -49,19 +49,62 @@
</resources>
<plugins>
<!-- Bouncycastle jars are signed and cannot be placed inside shaded jar.
we ship them beside our app in /lib -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-bouncycastle</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<stripVersion>true</stripVersion>
<artifactItems>
<artifactItem>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk15on</artifactId>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<artifactSet>
<excludes>
<exclude>org.bouncycastle:*:*:*</exclude>
</excludes>
</artifactSet>
<!-- broken with Java 8 (MSHADE-174), using ProGuard instead. -->
<minimizeJar>false</minimizeJar>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.bisq.gui.app.BisqAppMain</mainClass>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.bisq.gui.app.BisqAppMain</Main-Class>
<!-- the specified bouncy castle jar classes -->
<Class-Path>lib/bcpg-jdk15on.jar lib/bcprov-jdk15on.jar</Class-Path>
</manifestEntries>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<filters>
<filter>
<!-- exclude signatures, the bundling process breaks them for some reason -->
@ -233,7 +276,7 @@
org.bitcoinj:orchid:1.1.1:jar:null:compile:7898329eae76ec6bfdf27081234bb222d5be09df
</urn>
<urn>
org.bouncycastle:bcprov-jdk15on:1.53:jar:null:compile:9d3def2fa5a0d2ed0c1146e9945df10d29eb4ccb
org.bouncycastle:bcprov-jdk15on:1.56:jar:null:compile:9d3def2fa5a0d2ed0c1146e9945df10d29eb4ccb
</urn>
<urn>
org.controlsfx:controlsfx:8.0.6_20:jar:null:compile:5a4ca2765419fe12af0f0c7c5a8129c53bb661d9

24
pom.xml
View file

@ -131,19 +131,16 @@
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.56</version>
</dependency>
<!-- We need both bcpg-jdk15on and bcpg-jdk16 -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk15on</artifactId>
<version>1.56</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk16</artifactId>
<version>1.46</version>
</dependency>
<!--utils-->
@ -264,4 +261,25 @@
</profile>
</profiles>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.56</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk15on</artifactId>
<version>1.56</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpg-jdk16</artifactId>
<version>1.46</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>