How to generate complete Eclipse classpath during project import?

Eclipse Luna 4.4.1 Gradle 2.3-rc-1

I’m working on a multi-project Gradle build that ultimately creates a WAR file. The problem I am having is that none of the projects have the correct .classpath file after I import it into Eclipse. None of the ‘compile’ configuration dependencies that get exported to the deployment assembly are appearing in the .classpath.

I’ve found that if I run cleanEclipseClasspath after the import, and then eclipseClasspath, the rest of the .classpath file is generated and everything is working.

Why doesn’t this happen when I import the project? I checked the ‘Run before’ box and it runs cleanEclipse eclipse. I’d like the classpaths to be correct after the import. (Also, when the ‘eclipse’ task is run outside of eclipse via command line, the .classpath file is correct)

Edit: here is the incomplete classpath without the ‘compile’ configuration dependencies.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
 <classpathentry kind="src" path="src/main/java"/>
 <classpathentry kind="src" path="src/main/resources"/>
 <classpathentry kind="src" path="src/test/java"/>
 <classpathentry kind="src" path="src/test/resources"/>
 <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 <classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
 <classpathentry kind="output" path="bin"/>
</classpath>

And after running cleanEclipseClasspath eclipseClasspath:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
 <classpathentry kind="output" path="classes"/>
 <classpathentry kind="src" path="src/main/java"/>
 <classpathentry kind="src" path="src/main/resources"/>
 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/4a4b6d692e17846a9f3da036438a7ac491d3c814/aopalliance-1.0-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/aopalliance/aopalliance/1.0/235ba8b489512805ac13a8f9ea77a1ca5ebe3e8/aopalliance-1.0.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.8.4/f56abad2f304b21f81f03c309f4e60f704c44699/aspectjweaver-1.8.4-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.8.4/2ee166facba0b05c5dc444a934027baa114fddd9/aspectjweaver-1.8.4.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.bouncycastle/bcprov-ext-jdk16/1.46/f8b715ea4b72f9fc67062e9f1c056914d40b728a/bcprov-ext-jdk16-1.46.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/net.java.dev.vcc.thirdparty/collection-setter-injector/0.5.0-1/886deda9ddaf138f385dd155f42c0917e7b80d38/collection-setter-injector-0.5.0-1-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/net.java.dev.vcc.thirdparty/collection-setter-injector/0.5.0-1/2bda6be20f74df99602d569d2bd8ffdcf266787f/collection-setter-injector-0.5.0-1.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/commons-jexl/commons-jexl/1.1/95fac6451b0bed67b79c7b1a0b72603a07912f48/commons-jexl-1.1.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.jacorb/jacorb/3.5/2b66a82b2c17aaad401ff529ebff7efa5b372741/jacorb-3.5-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.jacorb/jacorb/3.5/318d8acf918e1be01a8cca837f3d1615d6691524/jacorb-3.5.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/net.sourceforge.jexcelapi/jxl/2.6.12/7e5ce7fe751bac58c5fe9eaf4600fd7f2d1bb112/jxl-2.6.12-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/net.sourceforge.jexcelapi/jxl/2.6.12/7faf62e0697f7a88954622dfe8c8de33ed142ac7/jxl-2.6.12.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/commons-dbcp/commons-dbcp/1.4/9b076ff231434d5403be6599a1347019b12c0def/commons-dbcp-1.4-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/commons-dbcp/commons-dbcp/1.4/30be73c965cc990b153a100aaaaafcf239f82d39/commons-dbcp-1.4.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.jacorb/jacorb-omgapi/3.5/ce0aaee914865efc78b5de082f4ac9e36454e15a/jacorb-omgapi-3.5-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.jacorb/jacorb-omgapi/3.5/1dad94cb929923bbe7c80ca3588daf364920d963/jacorb-omgapi-3.5.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.mybatis/mybatis/3.2.3/9f483d6809033a974d0409fd4dc3a3820286e646/mybatis-3.2.3-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.mybatis/mybatis/3.2.3/7eee8564f107ce26a89ab1563ae908d2ff88e32e/mybatis-3.2.3.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.mybatis/mybatis-spring/1.2.1/988bce36e79135244539cdb6d8ee9a716af42339/mybatis-spring-1.2.1-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.mybatis/mybatis-spring/1.2.1/c33ba121ab141e8a99812b975207db8bf8d65a66/mybatis-spring-1.2.1.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.10/4d2725efe68b9943ba0deaf334bb27116ca6b687/slf4j-api-1.7.10-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.10/5b338f206827d88acd890739f400a9b7664e5984/slf4j-api-1.7.10.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/4.0.5.RELEASE/2d8ec0d3a074b4a193c16312ab2cda105d87871f/spring-aop-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/4.0.5.RELEASE/d22abbbba78f7c8854fc39346cc99362272c5c90/spring-aop-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/4.0.5.RELEASE/589675b60574e292b76f8ef3bf36bec72a979e45/spring-beans-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/4.0.5.RELEASE/11e00022f109653ee0dbe16b59c26e19bd90fa08/spring-beans-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/4.0.5.RELEASE/aadd509610ea91906c177c33c22dd7e28df3b66/spring-context-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/4.0.5.RELEASE/98cd9a4b8bb0c695c0cfcc204cf804f433851cfe/spring-context-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context-support/4.0.5.RELEASE/eb9f8032cf5733924099e4992215bfb768afd274/spring-context-support-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context-support/4.0.5.RELEASE/bb6ddc22c49cb5bec1a756b0fbb138e2b705c508/spring-context-support-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/4.0.5.RELEASE/c8ccd8ae8bb85f917ef429d3cad37b1b36c92c49/spring-core-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/4.0.5.RELEASE/cce94116431b5a1384d58316a4090bbe7718fd5a/spring-core-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/4.0.5.RELEASE/11f705f4d73aa2f074d32602fd6a80898fd50257/spring-expression-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/4.0.5.RELEASE/d7ddbc320c31c15cb3612ed64607e181c3b2d851/spring-expression-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/4.0.5.RELEASE/74b483ae51c2645ef78c15103aaf5bf655c02c5a/spring-jdbc-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/4.0.5.RELEASE/464e18d797ef5f2f19e6b8c151ca0b196c806ad3/spring-jdbc-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jms/4.0.5.RELEASE/116a7419400c70b455a9ef87a245dc6c140779ab/spring-jms-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jms/4.0.5.RELEASE/e6c3eda3f5327e3861eea58283282e0e885a352e/spring-jms-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/4.0.5.RELEASE/d89ffc7cfa681682129f37fd35ea3fe2ee2267a4/spring-orm-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/4.0.5.RELEASE/8e2a686e8fb135fafbfb6eb97d55f0948c5b0467/spring-orm-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/4.0.5.RELEASE/a1334d0da26cd44f3930c8930be786cb13e8e9ec/spring-tx-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/4.0.5.RELEASE/bc94807ffcf9a6934428eb7ecdf9c37c41dd95a1/spring-tx-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/4.0.5.RELEASE/82389e66ef1cd0085d5a8a00c827ae5c93a8040b/spring-web-4.0.5.RELEASE-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/4.0.5.RELEASE/1819f6d4ab65fb33e19c492d5c5aa21396e42b3f/spring-web-4.0.5.RELEASE.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3/2b8664910b937aa77aaa388f2403ed019e37662e/servlet-api-2.3-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/javax.servlet/servlet-api/2.3/137a24e9f62973f01f16dd23fc1b5a9964fd9ef/servlet-api-2.3.jar">
  <attributes>
   <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  </attributes>
 </classpathentry>
 <classpathentry kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.ojdbc6/ojdbc6/11.1.0.7.0-Production/895e6dd810ba6c4ae83be2c5bce744bfed43ef7b/ojdbc6-11.1.0.7.0-Production.jar">
  <attributes>
   <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.17/677abe279b68c5e7490d6d50c6951376238d7d3e/log4j-1.2.17-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/log4j/log4j/1.2.17/5af35056b4d257e4b64b9e8069c0746e8b08629f/log4j-1.2.17.jar">
  <attributes>
   <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.10/49c7ee5f2f363e6fa8ce5faa7e3be49d0124884e/slf4j-log4j12-1.7.10-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.10/b3eeae7d1765f988a1f45ea81517191315c69c9e/slf4j-log4j12-1.7.10.jar">
  <attributes>
   <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/junit/junit/4.4/c6fcccd240bf9a32bb6f16917a70a416b0d249a8/junit-4.4-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/junit/junit/4.4/8f35ee1f35d2dadbb5029991449ee90c1bab4d4a/junit-4.4.jar">
  <attributes>
   <attribute name="org.eclipse.jst.component.nondependency" value=""/>
  </attributes>
 </classpathentry>
 <classpathentry sourcepath="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/28bb0405fddaf04f15058fbfbe01fe2780d7d3b6/commons-logging-1.1.3-sources.jar" kind="lib" path="C:/Users/michael81203/.gradle/caches/modules-2/files-2.1/commons-logging/commons-logging/1.1.3/f6f66e966c70a83ffbdb6f17a0919eaf7c8aca7f/commons-logging-1.1.3.jar" exported="true">
  <attributes>
   <attribute name="org.eclipse.jst.component.dependency" value="../"/>
  </attributes>
 </classpathentry>
</classpath>

I found the solution was to disable dependency management during import.

Source: http://forum.spring.io/forum/spring-projects/springsource-tool-suite/113981-gradle-import-produces-wrong-classpath-files