Eclipse and Idea plugin not adding transistive pom.xml dependencies to .classpath or IntelliJ runtime classpaths respectively


(Jason Hatton) #1

I am having trouble with missing POM dependencies for Spring when generating Eclipse and/or Idea files. Below is my entire build.gradle file.

apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'eclipse'
  repositories {
    mavenCentral()
    flatDir name: 'local-repo', dirs: 'local-repo'
}
  dependencies {
      testCompile (
        ['junit:junit:4.5'],
        ['org.mockito:mockito-core:1.8.5'],
    )
      compile (
  ['org.slf4j:slf4j-api:1.6.1'],
        ['commons-collections:commons-collections:3.2.1'],
        ['commons-lang:commons-lang:2.5'],
        ['jsyntaxpane:jsyntaxpane:0.9.5-b29'],
     ['ch.qos.logback:logback-parent:0.9.24'],
     ['org.springframework:spring-core:3.1.1.RELEASE'],
     ['org.springframework:spring-beans:3.1.1.RELEASE'],
        ['org.springframework:spring-context:3.1.1.RELEASE'],
    )
}

This is a Java SE project, no web or JEE stuff. I am getting a failure in Spring saying that cglib isn’t available. Looking at the list of jar dependencies in either IDE you definitely see that none of the pom dependencies are being referenced and they are not getting downloaded.

I can get it working by manually adding the cglib dependency but it looks like I am going to have manually have to add all of them.

Is there something I am missing?


(Peter Niederwieser) #2

First, you can remove all the square brackets from your dependency declarations. Second, where do you expect ‘cglib’ to come from? Is it referenced from ‘jsyntaxpane’ (it definitely isn’t referenced from any of the other libraries), and does that library come from your flatDir repo? Note that a flatDir repo doesn’t provide transitive dependency resolution. Only Maven and Ivy repos do.


(Jason Hatton) #3

I removed the brackets and it didn’t change anything. Must be suffering from syntactic sugar blindness :).

The cglib dependency is in the spring-context pom. I see it here http://repo1.maven.org/maven2/org/springframework/spring-context/3.1.1.RELEASE/spring-context-3.1.1.RELEASE.pom.


(Jason Hatton) #4

Ah I missed that optional is set to true for cglib. My apologies for taking away time on this.