StackOverflowError in EclipseWtpPlugin


(Carlo Luib-Finetti) #1

I don’t know why I suddenly get a StackOverflowError whatever task I’m calling in my multiproject build. The curious thing is: I did not change but removed a dependsOn statement on the WAR task. (the plugin: ‘eclipse-wtp’ is only defined in those projects which produce WAR artifact.)

Now, wenn running with “–stacktrace” I can see Gradle is apparently running in some endless loop:

Caused by: java.lang.StackOverflowError
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin$this$3$eachDependedUponEclipseProject.callCurrent(Unknown Sou
rce)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.eachDependedUponEclipseProject(EclipseWtpPlugin.groovy:231)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.this$3$eachDependedUponEclipseProject(EclipseWtpPlugin.groovy
)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin$this$3$eachDependedUponEclipseProject.callCurrent(Unknown Sou
rce)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.eachDependedUponEclipseProject(EclipseWtpPlugin.groovy:231)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.this$3$eachDependedUponEclipseProject(EclipseWtpPlugin.groovy
)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin$this$3$eachDependedUponEclipseProject.callCurrent(Unknown Sou
rce)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.eachDependedUponEclipseProject(EclipseWtpPlugin.groovy:231)
        at org.gradle.plugins.ide.eclipse.EclipseWtpPlugin.this$3$eachDependedUponEclipseProject(EclipseWtpPlugin.groovy
)
....

Any idea what’s going wrong here?


(Carlo Luib-Finetti) #2

I could figure out the problematic thing. In the dependencies section of my war project I have a switch statement:

switch (customer.toUpperCase()) {
  case 'BGETEM':
      runtime project(':de.uvdms.bgetem.common')
   runtime project(':de.uvdms.bgetem.server')
    break
  case 'BGHW':
   runtime project(':de.uvdms.bghw.common')
   //runtime project(':de.uvdms.bghw.server')
   break
                 case 'BGV':
   runtime project(':de.uvdms.bgv.common')
   runtime project(':de.uvdms.bgv.server')
       break
...
}

What is commented out above is the bad boy. But I cannot see WHY there is a problem. The other cases are just constructed the same way.


(Alexander Melnik) #3

EclipseWtpPlugin.eachDependedUponEclipseProject(EclipseWtpPlugin.groovy:231)

def dependedUponProjects = projectDeps*.dependencyProject
           for (dependedUponProject in dependedUponProjects) {
               dependedUponProject.plugins.withType(EclipseWtpPlugin) { action(dependedUponProject) }
               eachDependedUponEclipseProject(dependedUponProject, action)
           }

Stackoverflow is a result of the recursion (dependency cycle)


(Carlo Luib-Finetti) #4

Yes, Alexander, you’re right. The problem came into the game when I modelled the construction of a tar artifact which has different jars for packaging, depending on the target customer build. There was a cycle in the dependency graph.

Not sure if Gradle should have detected it instead of hanging in this endless loop. Anyway, when I put an apply plugin: ‘eclipse-wtp’ in one those projects, Gradle showed the cycle.