Skip to content

Instantly share code, notes, and snippets.

@jt-nti
Last active July 23, 2020 18:48
Show Gist options
  • Save jt-nti/cedafc334a68598fa8674644fd1ef1ad to your computer and use it in GitHub Desktop.
Save jt-nti/cedafc334a68598fa8674644fd1ef1ad to your computer and use it in GitHub Desktop.
Hackety hack to publish jars to a directory inside a Hyperledger Fabric smart contract
/*
* This gradle init script can be used to publish jars to a repository folder
* inside a Fabric contract project. For example, in the `fabric-chaincode-java` project:
*
* ./gradlew -I ~/chaincode-init.gradle -PchaincodeRepoDir=<chaincode_dir>/repository publishShimJarPublicationToFabricRepository publishProtosJarPublicationToFabricRepository
*
* Where <chaincode_dir> is the chaincode location containing your contract!
*
* Fabric contract projects can then use jars from the bundled maven repository
* during the Fabric instantiation process by adding the following repository
* to their build.gradle file:
*
* maven {
* url "$projectDir/repository"
* }
*
* Note: this should be placed before other repositories which might contain
* the jars you published
*
*/
allprojects {
apply plugin: 'maven-publish'
publishing {
repositories {
maven {
name = 'fabric'
url = "file:$chaincodeRepoDir"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment