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
Problem when adding Caffeine to a Tar in Gradle #716
Comments
hmm.. that's something I can't answer. The |
This project isn't using the shadow plugin at all, but maybe it goes the other way and the distribution plugin builds on the shadow plugin. |
hmm, then I don't know why that configuration would exist? The shadow plugin is external, whereas the distribution is internal. It is used by the JMH plugin for benchmarks, which might mean it leaks into Caffeine's gradle metadata file. I'm not sure why that would cause breaks though. |
yeah, I see it in the module descriptor. I don't know enough about how Gradle uses this and why it would conflict. {
"name": "shadowRuntimeElements",
"attributes": {
"org.gradle.category": "library",
"org.gradle.dependency.bundling": "shadowed",
"org.gradle.libraryelements": "jar",
"org.gradle.usage": "java-runtime"
},
"files": [
{
"name": "caffeine-3.0.3-all.jar",
"url": "caffeine-3.0.3-all.jar",
"size": 1098775,
"sha512": "8a42cff3abb1ffa60616504f0af75cac75dbe15137e777188926d76b23d1865a36f3f773946426c3f11e834932bc1161d9828a209885799b41d9f32241386119",
"sha256": "a2d5edfb572bf47da90c68b55195baa84f9f1ae81a4fa13e2151b29e44f8021b",
"sha1": "206aa3f4706839ac2970c447ce6575f716a99e06",
"md5": "9597edf3a8a476607c33d14582621c7d"
}
]
} |
Trying to remove the shadow plugin from the build and it seems fine. Unfortunately I did not describe the issue very well in the git commit. I think it was an issue with Ehcache2 + Ehcache3, which later became incompatible dependencies. Whatever was wrong, a jmh benchmark with Ehcache3 seems to run fine so I could remove that going forward. We could try a snapshot build and see if that resolves your problem. Wdyt? |
@alkamo please try 3.1.1-SNAPSHOT and let me know if that resolves the problem |
3.1.1-SNAPSHOT did resolve the problem. Looking at the full error message, I think I might have been able to get around this by telling Gradle to require the Java 11 version or the "external" bundling for the tar, since those are the attributes that differ between the two variants (I just haven't been able to figure out how to do that).
|
I find the new resolution behavior very confusing and frustrating. It breaks the gradle-versions-plugin even though that uses apis since 1.0 and does simple version lookups. I think they might have tried to evolve to solve too many problems (android, native). I'll try to have this out by next Monday. Just waiting to see if the fix for #715 can be verified by the user before cutting the release. |
Released 3.1.1 |
same issue with 2.9.3 with java 8, any workaround ? |
I think you can tell gradle which to select. |
Thankyou, can you pls give an example of selecting Variant 'runtimeElements' capability in |
It might take me a while to have free time to look into that. A broader approach that I have used to workaround gradle plugin portal outages is to disable the metadata entirely. It isn't useful for server-side builds most of the time and seems to be mostly for kotlin and android quirkiness. repositories {
maven {
url "http://repo.mycompany.com/repo"
metadataSources {
mavenPom()
artifact()
}
}
} |
Here is what chatgpt said, might work too.
|
and when confirming, it said,
|
thankyou for response but the above solution from ChatGPT does works with gradle 6.7.1. Error "Could not set unknown property 'classifier' for object of type org.gradle.api.internal.artifacts.DefaultExcludeRule" |
how about the |
It was already there under "buildscript" in my build.gradle
I also tried adding it outside buildscript scope like
|
odd.. did you try with I can't reproduce this problem so unfortunately I don't know how to debug this. |
does not work with |
since all I can do is guess, what about using an attribute to force the selection?
|
finally works as below:
|
Gradle Version: 6.3
Java Version: 11.0.11 (Amazon.com Inc. 11.0.11+9-LTS)
Caffeine Version: 3.0.3
This is probably a configuration problem on my part, but I'm not sure where else to ask about it.
I have a gradle sub-project that gets caffeine as a transitive dependency (from jdbi). It builds without issue. However, I have a separate gradle sub-project that pulls the first artifact and its dependencies into a tar using the distribution plugin, using the following configuration:
When the caffeine version is 3.x and I run the distTar task for this configuration, I get the following error:
If I bring the dependency down to the point where the Caffeine dependency resolves to 2.x, this issue goes away.
The text was updated successfully, but these errors were encountered: