-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shadow Jar for modular project with module-info #710
Comments
|
Is it possible to include |
@johnrengelman the decision to exclude Please leave configurations {
moduleJar {
canBeConsumed = true
canBeResolved = false
}
}
task appendModueInfo(type: Jar, dependsOn: tasks.shadowJar) {
group 'shadow'
from zipTree(tasks.shadowJar.archiveFile)
from tasks.compileJava.destinationDirectory.file('module-info.class')
archiveBaseName.set(tasks.shadowJar.archiveBaseName)
archiveVersion.set(tasks.shadowJar.archiveVersion)
archiveClassifier.set('module')
duplicatesStrategy = DuplicatesStrategy.FAIL
}
artifacts {
moduleJar(tasks.appendModueInfo) {
builtBy(tasks.appendModueInfo)
}
} |
I started looking into this, but I'm not seeing an easy path to support it yet. The only idea i've got here is to not use |
The following seems to work in my case:
|
Even if module-info is excluded from dependencies, it should NOT be excluded from being carried over from your original project jar. That would mean that you've effectively removed JPMS configuration from the jar. If that is happening, why would that be excluded? When I look at the resultant jar, it's not being carried over, which results in errors in my build. I see that the plugin code code is very explicitly excluding module-info.class from the shadowed jar. Can someone explain why this is happening? |
You can try out #520 (comment) for including project module-info. |
Shadow Version
Version 7.0.0
Gradle Version
Version 7.2
Gradle Build Script(s)
I'm trying to build a shadow jar for my library that depends on another library, I'd like to ship my jar with the dependency already included.
The issue is that my project is a modular project, there's the library itself that is the "main" module and then there's a preview of the library which is the "demo" module
Both modules have their respective module-info.java, when I build the shadow jar the build fails because the "demo" module cannot find the required "main" module. In fact if I open the shadow jar there's no module info in the archive
The text was updated successfully, but these errors were encountered: