Shade ASM to avoid classpath conflict conflicts
+plugins {
+ id 'com.github.johnrengelman.shadow' version '5.1.0'
+}
+
apply plugin: 'java'
+// Add a new configuration 'bundle' for fine grain control on what artifacts to shadow.
+configurations {
+ bundle
+ compile.extendsFrom bundle
+}
+
dependencies {
compile project(':governator-api')
compile project(':governator-core')
- compile 'org.ow2.asm:asm:7.2'
compile 'com.fasterxml.jackson.core:jackson-databind:2.4.3'
-
compile "javax.xml.bind:jaxb-api:${jaxb_version}"
+ // ASM is being shaded
+ bundle 'org.ow2.asm:asm:7.2'
+
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'com.tngtech.java:junit-dataprovider:1.11.0'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile "com.google.code.findbugs:jsr305:3.0.0"
+}
+
+shadowJar {
+ classifier = null
+ configurations = [project.configurations.bundle]
+
+ exclude 'module-info.class'
+ relocate 'org.objectweb.asm', 'com.netflix.governator.asm'
+}
+
+jar {
+ enabled = false
+}
+jar.dependsOn shadowJar
+// Remove asm from published pom file
+afterEvaluate {
+ publishing {
+ publications {
+ // to remove shaded dependency from pom.xml
+ withType(MavenPublication) {
+ pom.withXml {
+ asNode().dependencies.dependency.findAll {
+ it.artifactId.text() == "asm"
+ }
+ .each {
+ it.parent().remove(it)
+ }
+ }
+ }
+ }
+ }
}
