Eclipse can't find the sources when using eclipse-wtp


(Kent Tong) #1

I’d like to download the sources of dependences for use in Eclipse. Gradle downloads the sources just fine. In fact, the source is specified in the .classpath generated. However, eclipse doesn’t seem to find the source. I have to manually select the external path to it. The weird thing is, this action seems to cause no change to any file in the project folder, so I can’t track what makes the difference and how to fix it.

Below is my build.gradle file:

plugins {
  id 'java'
  id 'application'
  id 'eclipse'
  id 'war'
  id 'eclipse-wtp'  

eclipse {
    classpath {
repositories {

dependencies {
  compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.1'
  compile group: 'joda-time', name: 'joda-time', version: '2.9.9'
  providedCompile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'
  compile group: 'org.apache.struts', name: 'struts2-core', version: ''

The entry in .classpath is:

<classpathentry sourcepath="/home/kent/.gradle/caches/modules-2/files-2.1/org.apache.struts/struts2-core/" kind="lib" path="/home/kent/.gradle/caches/modules-2/files-2.1/org.apache.struts/struts2-core/">
            <attribute name="org.eclipse.jst.component.nondependency" value=""/>

Any idea how to make it work automatically?

Thanks in advance