wttech/gradle-aem-plugin

embedPackage does not work, third party jar not included

harrisaemguy opened this issue · 6 comments

import com.cognifide.gradle.aem.bundle.tasks.bundle

tasks {
jar {
bundle {
embedPackage("io.jsonwebtoken:jjwt-impl:0.11.2") // package will be a part of 'Private-Package'
}
}
}

And I run: gradle clean jar
Check the generated jar file, could not find the jar file.

Also how to use embedPackage("io.jsonwebtoken:jjwt-impl:0.11.2") in build.gradle, instead of kts style ?

I will check that for you tomorrow. Cheers

nope, it works. you forgot about specifying package name to be embedded; you specified only a jar Maven coordinates via so-called dependency notation.

image

plugins {
    id("com.cognifide.aem.bundle")
    id("com.cognifide.aem.package")
}

tasks {
    jar {
        bundle {
            embedPackage("io.jsonwebtoken:jjwt-impl:0.11.2", "io.jsonwebtoken")
        }
    }
}

@pun-ky Thanks, you're right, I missed the second parameter.
What is the syntax to use this "embedPackage" feature in gradle groovy format ?
My IDE and build script are mostly in groovy syntax. The kotlin syntax is only supported by android..
Thanks,

Thanks, it works in groovy as well. Here is sample:
jar {
// embedPackage("io.jsonwebtoken:jjwt-impl:0.11.2", ["io.jsonwebtoken"], true)
embedPackage('commons-codec:commons-codec:1.13', ['org.apache.commons.codec.'], false)
embedPackage('org.apache.commons:commons-collections4:4.4', [
'org.apache.commons.collections4.
'
], false)
embedPackage('org.apache.commons:commons-compress:1.19', [
'org.apache.commons.compress.'
], false)
embedPackage('org.apache.commons:commons-math3:3.6.1', [
'org.apache.commons.embedPackage.
'
], false)
}

Beware that GAP is no longer supporting groovy dsl since 8.x version as it is much easier to use kotlin dsl due better IDE support