Skip to content

Creating a simple Java application project

James Taylor edited this page Jul 12, 2019 · 8 revisions

Assumptions:

  • prereqs installed already (Java, Gradle, etc.)

Notes:

Run gradle init --type java-library in a suitable directory, e.g. simple-fabric-client-java

Add the following dependency to build.gradle

    implementation 'org.hyperledger.fabric-gateway-java:fabric-gateway-java:1.4.0-SNAPSHOT'

Add the following repositories to build.gradle (only required for snapshots)

    maven {
        url 'https://nexus.hyperledger.org/content/repositories/snapshots/'
    }

    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }

Run a build to see if the dependencies can be found.

Weep.

Attempt to build the gateway yourself...

git clone https://github.com/hyperledger/fabric-gateway-java.git
cd fabric-gateway-java
mvn install -DskipTests

Add the following repository to build.gradle

    mavenLocal()

Write a simple client app based on the sample in the gateway readme. For example, Sample.java

Need a connection profile. Apparently this is not particularly straightforward, or documented anywhere; a profile exported from the vscode extension won't work, but may provide a useful starting point.

"A static connection profile is normally created by an administrator who understands the network topology in detail." ...oh. Bother.

Clone this wiki locally