Skip to content

Commit

Permalink
make core a fat jar without external dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
OriYosefiMSFT committed Oct 31, 2016
1 parent 55c4955 commit 799a839
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core/build.gradle
Expand Up @@ -18,6 +18,9 @@
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
plugins {
id 'com.github.johnrengelman.shadow' version '1.2.3'
}

apply from: "$buildScriptsDir/common-java.gradle"
apply from: "$buildScriptsDir/publishing.gradle"
Expand All @@ -43,6 +46,19 @@ dependencies {
testCompile group: 'com.google.code.gson', name: 'gson', version: '1.7.2'
}

shadowJar {
classifier=''

This comment has been minimized.

Copy link
@isaac84

isaac84 Apr 7, 2017

This fat jar also includes 'javax.annotation' and 'org.objectweb' packages that are not relocated. Which causes a SecurityException when asm-3.2.jar is also on the classpath and you try and load the org.objectweb.asm.MethodAdapter class.

java.lang.SecurityException: class "org.objectweb.asm.MethodAdapter"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(ClassLoader.java:898)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:668)
at java.lang.ClassLoader.defineClass(ClassLoader.java:761)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

Could you exclude or also relocate these packages.

relocate 'org.apache.http', 'com.microsoft.applicationinsights.core.dependencies.http'
relocate 'eu.infomas.annotation', 'com.microsoft.applicationinsights.core.dependencies.annotation'
relocate 'org.apache.commons', 'com.microsoft.applicationinsights.core.dependencies.apachecommons'
relocate 'com.google.common', 'com.microsoft.applicationinsights.core.dependencies.googlecommon '
}

jar {
dependsOn shadowJar
enabled = false
}

def sdkVersionFileDir = "$project.buildDir/src/generated/main/resources"
task generateVersionProperties(type: PropsFileGen) {
targetFile = new File(sdkVersionFileDir, "sdk-version.properties")
Expand Down

0 comments on commit 799a839

Please sign in to comment.