-
Notifications
You must be signed in to change notification settings - Fork 6
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
Packaging multiproject build into fat jar fails #7
Comments
Building a fat jar of a properly modularized application, imo, kind of contradicts the idea of JPMS. You won't be able to run such a jar on the module path and experience all the benefits of JPMS. Have you considered using the standard 'application' plugin instead? Gradle has a first class support of JPMS there. |
Thank you, you are right that we lose the benefits of module boundaries and constraints during runtime if we package it as a fat jar. But we still get all the benefits from the module system during development. |
@MikaelAmborn this seems to reveal an issue in the shadow plugin and how it defines its input for the You can disable the functionality of this plugin for the "runtimeClasspath" of the application. I think this is fine/good as you throw away the module information at runtime in any case. If you do it, the shadow plugin works as expected. app/build.gradle
|
Thank you for the suggested solution. The problem with it is that it breaks |
@MikaelAmborn yes I did not think about this. I think you can also keep the normal runtimeClasspath untouched, but instead create a specific one for the shadowJar only. Something like this:
Does that work for you? |
Thank you for your reply, with some minor changes everyting seems to work:
|
With a JPMS enabled gradle multi-project I fail to build a fat jar using this plugin and the Gradle shadow plugin.
I created a minimal test project to showcase the error https://github.com/MikaelAmborn/javamodules. Clone it and run
./gradlew shadowJar
and it will fails onExtraModuleInfoTransform.java:85
with this error:But if you first build a jar for the
utilities
project with./gradlew utilities:jar
and then./gradlew shadowJar
everything works.Could it be related to gradle/gradle#10484?
The text was updated successfully, but these errors were encountered: