-
Notifications
You must be signed in to change notification settings - Fork 397
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
IntelliJ IDEA unable to resolve classes of project dependency shadow jar #264
Comments
Any ideas as to why I would experience this issue @johnrengelman ? |
Same Issue here. |
Only workaround I found was to add all transitive project dependencies as a shadow dependency in every single build file. So 'rpcapi' has 'core', 'common' has 'rpcapi' and 'core', and so on. Not really an ideal solution, but it'll do the job until this issue is resolved. |
Does someone have a simple project on github that exhibits the problem? |
Unfortunately not as this issue is part of a large project I work on for the company I'm contracted with. I can work on making an example project that replicates the issue, but I can't get to that immediately. |
For an example, you can look at https://github.com/TNG/JGiven, where the same problem exists. Neither using |
There is also an open defect for IntelliJ regarding this issue: https://youtrack.jetbrains.com/issue/IDEA-163411 |
Why is this causing compile errors in one file in my fairly large Android Studio project? See the issue referenced by @dariuszeweryn above. Everything else compiles OK. |
Is there any workaround for this? |
workaround I came up with: use shadow jars for the libraries that depend on the core jar, but set configurations to an empty in their config, and set it to project.configurations.compile on the core jar build.gradle |
@MicleBrick Can you post some example configuration please? I don't know how to apply your mentioned workaround. |
if you're having the same issue you should just be able to make the changes i mentioned in the relevant places. make all of the sub projects use shadow to make their jars. check the docs to see how to configure which configurations shadow packs into the jar. |
@johnrengelman you asked if anyone has a project on github that exhibits the problem. I have an open source project at https://github.com/autonomousapps/dependency-analysis-android-gradle-plugin/tree/pub-antlr. If you check out that branch and import it into IDEA, you should see the problem. It compiles from the command line but the class |
For what it's worth, I was able to achieve a workaround by adding a dependency to the output of the Project structure:
producer's
consumer's
IDEA will not run the
This can also be configured without needing to set it manually in IDEA, with the help of the In the project's root
|
After playing around a bit, I've found that uploading the shadow jar to one's local Maven repository and referencing that instead is probably the easiest solution. Project structure
producer's build.gradle:
consumer's build.gradle:
This works well with IDEA, as IntelliJ will resolve the shadow jar from the local Maven repo. |
Hi @autonomousapps , I tried to go to your existing thread with Cedric and folks but is gone (thanks Slack free tier). do you recall what things you tried? I saw that in your repo you produce a jar for publishing a jar and import it on intellij is far from ideal, same as creating dependencies between project tasks and cross the boundaries. I don't even think using feature/variants help much here. What are your thoughts? |
I gave up and never tried again.
On August 13, 2021, GitHub ***@***.***> wrote:
Hi @autonomousapps <https://github.com/autonomousapps> , I tried to go
to your existing thread with Cedric and folks but is gone (thanks
Slack free tier).
do you recall what things you tried? or did you ever overcome this
issue?
publishing a jar and import it on intellij is far from ideal, same as
creating dependencies between project tasks and cross the boundaries.
I don't even think using feature/variants help much here. What are
your thoughts?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#264 (comment)
898754446>, or unsubscribe
<https://github.com/notifications/unsubscribe-
auth/ABJG5PLTE7DTKLX7MUP63ZLT4WNJRANCNFSM4CX7TYIQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-
email&mt=8&pt=524675> or Android
<https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-
email>.
|
I have a similar issue, but with dependencies that are part of the I've tried the suggested workaround with I have a project to reproduce this, with the following steps:
So the And it seems that intellij can't resolve that. If I add something like this to the build file: Am I doing something wrong with my build configuration? Is this actual behavior of |
Shadow: 1.2.4
Gradle: 2.5
From what I understand
compile project(path: ':common', configuration: 'shadow')
should result in the shaded artifact being selected as a dependency. This appears to work, however, IntelliJ IDEA will not resolve the contents of the shaded artifact.Now here is the weird thing, if I change the configuration of the project dependencies to compile, the IDE is able to resolve the classes but the compiler cannot. If I change it back to shadow the compiler can resolve the classes and the IDE cannot... o.O
root build.gradle
subproject core build.gradle
subproject rpcapi build.gradle
And so on...
The text was updated successfully, but these errors were encountered: