Hyperledger Fabric-sdk-java
Hyperledger Fabric-sdk-java
I use the environment macOS High Sierra 10.13.4
,Java 9.0.4
Currently Hyperledger Fabric official is mainly supported fabric-sdk-node
, and have a more comprehensive documentation in English. However, my project requirements as Java, all can be downloaded fabric-sdk-java
.
Prerequisite:
- Apache Maven (can be installed via the homebrew)
- JDK 1.8+ (recommended is 1.8, with 1.8 project is written with
Java 9
meet some weird problems and the same will I) - IDEA
Download Project
git clone https://github.com/hyperledger/fabric-sdk-java
- 1
Import project
IDEA, maven project to import the project, import dependence.
A small amount of third-party libraries, before you can run the following command in the root directory:
mvn dependency:tree
- 1
Run fabric
cd fabric-sdk-java/src/test/fixture/sdkintegration
./fabric up
- 1
- 2
If the corresponding docker-compose.yaml under the modified image error can not find the fabric-sdk-java / src / test / fixture / sdkintegration appearances image tag
can be.
Run the test case
We selected commonly used End2endIT.java
to run.
Then you will find that we have not included code from clong down in org.hyperledger.fabric.protos
this package. So we need to download this package, and add it to the corresponding position in our project. Here are a source of Download
After we download the corresponding jar file extraction, you can import the corresponding package.
Because it is JDK code, we use Java 9
have some options when compiling Note
We need a version byte code file are set to 9. And add the following several parameters on the command line parameters.
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED --add-modules java.xml.bind --add-modules java.corba
- 1
In addition, we also need to modify pom.xml files in the project
The source
and target
the 1.8
have changed 9
if the difference is still reported some classes at compile time, in their own pom.xml
in adding a corresponding dependency. For example, I am sending java.annotation
me dependency
to add in the
After rely on us to solve these over again compiled should be able to successfully run. Results are as follows in FIG.