Gradle 4.1 RC2 Needlessly Including Dependencies in jar

I’m pretty sure I’m running into a known issue with the Java plugin for Gradle.

I have a project that builds all fine in 4.0.2, but creates a bad jar in 4.1 because it’s pulling in a bunch of dependencies that it shouldn’t (some of which are provided in the base project). Those are creating conflicts in the classpath.

Trouble is, I have no idea what to do to my build file to fix it.

In the working version (4.0.2), I have this when I run the build with --debug:
[org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting configuration com.myproject.platform:sharedSubProject:5.0.16-SNAPSHOT(default).

This gets followed by messages about all the dependencies that are getting excluded, like
[org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] com.atlassian.sal:sal-api is excluded from com.myproject.platform:sharedSubProject:5.0.16-SNAPSHOT(default). (edited)

In the failing version (4.1 RC2), the verbose debug log looks like
[org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder] Visiting configuration com…myproject.platform:sharedSubProject:5.0.16-SNAPSHOT(runtimeElements).

This is a relatively complex project. It’s got multiple sub-projects, with a shared sub-project used by all of them.

I’ve tried applying the Java plugin to all of the subprojects, but that doesn’t resolve the issue. I don’t quite understand the underlying bug well enough to reason about what needs to be fixed to exclude dependencies properly, and whether that should be a bug report on Github or if there’s something I can change in my build that will rectify the issue.

Any pointers?

If you could provide a stripped-down example (especially what you mean by ‘provided in the base project’), there’s a better chance of helping you find the problem :slight_smile:

I hear you, @st_oehme. I don’t expect I’ll have a chance to hack together such a project anytime soon, given that 4.0 works for our purposes. Still, if this is still an issue in the final release and I need to submit a bug report, I’ll make sure to include such a project.

Thanks!

4.1 was released last week.