diff --git a/node-api/build.gradle b/node-api/build.gradle index 1edbe50840..6651c19531 100644 --- a/node-api/build.gradle +++ b/node-api/build.gradle @@ -7,7 +7,9 @@ * * Distribution of this file or any portion thereof via any medium without the express permission of R3 is strictly prohibited. */ - +plugins { + id "com.github.johnrengelman.shadow" version "2.0.3" +} apply plugin: 'kotlin' apply plugin: 'net.corda.plugins.quasar-utils' apply plugin: 'net.corda.plugins.publish-utils' @@ -52,7 +54,8 @@ dependencies { runtime 'com.mattbertolini:liquibase-slf4j:2.0.0' // Apache Curator: a client library for Zookeeper - compile "org.apache.curator:curator-recipes:${curator_version}" + shadow "org.apache.curator:curator-recipes:${curator_version}" + testCompile configurations.shadow // need to look at rewritten classes testCompile "org.apache.curator:curator-test:${curator_version}" // FastClasspathScanner: classpath scanning - needed for the NetworkBootstraper @@ -76,6 +79,31 @@ configurations { testArtifacts.extendsFrom testRuntime } +jar { + baseName 'corda-node-api' +} +// ensure that immediately after jar step we update to the shaded version of the jar, so that everyone use it. +jar.finalizedBy shadowJar + +shadowJar { + baseName jar.baseName + configurations = [project.configurations.shadow] + classifier "" + dependencies { + include(dependency("org.apache.curator:curator-recipes:${curator_version}")) + include(dependency('org.apache.zookeeper:zookeeper:3.5.3-beta')) + include(dependency('commons-cli:commons-cli:1.2')) + include(dependency('io.netty:netty:3.10.5.Final')) + include(dependency('com.google.guava:guava:20.0')) + } + relocate 'org.apache.curator.', 'net.corda.shaded.org.apache.curator.' + relocate 'org.apache.zookeeper.', 'net.corda.shaded.org.apache.zookeeper.' + relocate 'org.apache.jute.', 'net.corda.shaded.org.apache.jute.' + relocate 'org.apache.commons.', 'net.corda.shaded.org.apache.commons.' + relocate 'org.jboss.netty.', 'net.corda.shaded.org.jboss.netty.' + relocate 'com.google.', 'net.corda.shaded.com.google.' +} + task testJar(type: Jar) { classifier "tests" from sourceSets.test.output @@ -85,10 +113,6 @@ artifacts { testArtifacts testJar } -jar { - baseName 'corda-node-api' -} - publish { - name jar.baseName + name shadowJar.baseName }