buildship icon indicating copy to clipboard operation
buildship copied to clipboard

Missing (eclipse) inter-project dependencies for gradle multi-module build

Open aanno opened this issue 3 years ago • 7 comments

Expected Behavior

For the example at https://github.com/aanno/Servlet-4.0-Sampler/tree/report/eclipse-buildship-jee (branch: report/eclipse-buildship-jee), I expect buildship to set up the eclipse inter-project dependencies but it does not.

Current Behavior

Buildship does not set up any (eclipse) inter-project dependency that are expressed in the multi-module gradle build.

Context

Multi-mpdule dependencies in my example are as follows:

  • ejb2 -dependsOn-> ejb1
  • war -dependsOn-> ejb2
  • ear -deployDependsOn-> ejb1, ejb2, war

Steps to Reproduce

Use my example and import it as gradle project into eclipse/buildship.

Your Environment

gradle build scan URL: https://gradle.com/s/vexbbemydkbfs

aanno avatar Jan 14 '22 09:01 aanno

Any news on this? I'm getting hit by the same issue, and I can't find a workaround either...

DarkShadow44 avatar Feb 13 '22 01:02 DarkShadow44

Found a dirty workaround:

task fixClasspath {
    doLast {
        file(".classpath").withWriter { writer ->
            new groovy.xml.MarkupBuilder(new IndentPrinter(writer, "    ", true)).classpath {
                classpathentry(kind:"src", path:"/ap")
            }
        }
    }
}

eclipseJdtApt.dependsOn fixClasspath

This will create a .classpath file with the dependency on the "ap" project. buildship will merge the .classpath file properly, making eclipse have a dependency on the ap project. Maybe it helps someone.

DarkShadow44 avatar Feb 13 '22 21:02 DarkShadow44

You can do the workaround in the eclipse.classpath.file.whenMerged block as well.

donat avatar Feb 23 '22 16:02 donat

In the ear project, you probably need to add the deploy dependency scope to eclipse.classpath.plusConfigurations.

donat avatar Feb 23 '22 16:02 donat

You can do the workaround in the eclipse.classpath.file.whenMerged block as well.

I tried and tried and it simply didn't work. How does it work for you?

DarkShadow44 avatar Feb 23 '22 17:02 DarkShadow44

You can find a couple of examples here: https://discuss.gradle.org/t/buildship-1-0-18-is-now-available/19012

At the same time, the solution with eclipse.classpath.plusConfigurations is more preferable imho.

donat avatar Feb 24 '22 10:02 donat

As I said, I tried that and it didn't work.

DarkShadow44 avatar Feb 24 '22 20:02 DarkShadow44