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
gradle-api-x.y.jar contains too many properties which may break tests #3780
Comments
For 4.4.1 we should exclude the JGit .properties files from the API jar. They are always looked up using the qualified name, so we don't need to keep the copy with the original name. Long term we need to come up with a better solution for our API jar, since these leakages keep biting us. @big-guy Since the native team introduced this dependency, would you mind taking over this issue? |
@oehme yep, we'll take a look. |
Do not leave JGit resources in their original location in gradle api Enable test that reproduces #3780 Only run test on JDK8+ because JGit 4.6+ requires it
This has been fixed in release |
* origin/release: Fix JGit leakage regression Add failing test for #3780 Add smoke test for dependency lock plugin using 2 different versions Reinstate constructor that is used by Nebula dependency-lock plugin Bump version and reset binary compatibility baseline Use Gradle 4.4 to build Upgrade kotlin-dsl {0.13.1 => 0.13.2} Let production build environment assertion allow using Java 8 to run the build (#3746) Let the JVM used to run tests in the gradle/gradle build be set by a Gradle/System property (#3735)
Expected Behavior
Generated gradle-api-x.y.jar should be at the end of test classpath when forking test worker process.
Current Behavior
Now it's at the beginning of the test classpath, which might cause weird test failures.
Context
Recently I found a build of mine is broken after upgrading to
4.4
. The failure looks unrelated to the upgrade, but it does exist. I extract a minimum sample here: https://github.com/blindpirate/gradle44-breaking-changeIn short, some 3rd dependencies might be leaked into test classpath. If I run test with dependency
gradleApi()
, the simple test would succeed with4.3.1
, but fail with4.4
. However, running in IDEA always succeed andgradle dependencies
with4.3.1
and4.4
are identical:After some investigation, finally I found the reason is the huge
gradle-api-x.y.jar
which is generated by Gradle when it encountersgradleApi
dependency declaration.Previously,
gradle-api-4.3.1.jar
didn't contain any JGit dependencies so it works fine. In4.4
, JGit was introduced intoversion-control
subproject, so its resources are shaded intogradle-api-4.4.jar
. In this case,org/eclipse/jgit/internal/JGitText.properties
from org.eclipse.jgit:org.eclipse.jgit:4.5.3.201708160445-r are loaded fromgradle-api-4.4.jar
instead of the correct JGit jar. We can see the debug log at this line, the test classpath order is:Looks like there're no work arounds.
Steps to Reproduce (for bugs)
https://github.com/blindpirate/gradle44-breaking-change
The text was updated successfully, but these errors were encountered: