Skip to content
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

Weird minimize() behavior #744

Open
re-ovo opened this issue Jan 10, 2022 · 0 comments
Open

Weird minimize() behavior #744

re-ovo opened this issue Jan 10, 2022 · 0 comments

Comments

@re-ovo
Copy link

re-ovo commented Jan 10, 2022

I recently converted my project to a multi-module project, but I'm having trouble using shadowjar's minimize feature. Here is my project structure:

Root project 'shadow-jar-test'
+--- Project ':api'
\--- Project ':core'

This is a multi-module project, core depends on the api module, and both core and api have some third-party dependencies(For example Kotlin std library). And, I implemented these 2 modules in the root project's build script and want to package them into a jar.

The problem is, when I add minimize() to the shadowjar task, it reduces all my code, it seems that it thinks that the subproject is also a third-party dependency.

shadowJar {
    relocate 'kotlin', 'lib.kotlin'
    relocate 'org.jetbrains', 'lib.org.jetbrains'

    // minimize will remove the :core and :api module?
    minimize()
}

I also tried add exclude statement into minimize:

minimize {
        exclude(project(":core"))
        exclude(project(":api"))
}

This will indeed package core and api, but the third-party libraries that core and api depend on are still not packaged

Shadow Version

7.0.0

Gradle Version

7.1

Expected Behavior

Properly minimize dependencies

Actual Behavior

It also minimized my project code?!

Gradle Build Script(s)

I created a example project to reproduce it:
https://github.com/re-ovo/shadow-jar-test

This is the root project build script:
https://github.com/re-ovo/shadow-jar-test/blob/master/build.gradle

tommyettinger added a commit to tommyettinger/libgdx-tiledmappacker that referenced this issue Oct 9, 2022
Its minimize() feature, the only part I care about, seems badly broken. The project is looking unmaintained, also; this issue about the same thing from 9 months ago has no response. GradleUp/shadow#744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants