Eclipse plugin doesn't honour cache timeouts for snapshot source/javadoc artifacts


(Jérémie Charest) #1

We are having trouble to get our sources artifacts correctly updated with the eclipse plugin for snapshots version. Our projects are in Java and the repository is a maven 2 layout. Snapshot caching is disabled. Sources artifacts are downloaded once per version of dependency are further updates (snapshots) are not downloaded.

------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------
  Build time:
 2014-04-29 09:24:31 UTC
Build number: none
Revision:
   a831fa866d46cbee94e61a09af15f9dd95987421
  Groovy:
     1.8.6
Ant:
        Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy:
        2.2.0
JVM:
        1.7.0_10 (Oracle Corporation 23.6-b04)
OS:
         Windows 7 6.1 amd64

The following example involved two projects : eclipse-java and mongo-java. The eclipse task is invoke in the eclipse-java project that depend on mongo-java artifact. This is not a project dependency.

The problem is 100% reproducible with those steps for direct dependency or transitive dependency as well.

Build.gradle (simplify)

sourceCompatibility = 1.7
targetCompatibility = 1.7
  configurations.all {
  resolutionStrategy {
    cacheDynamicVersionsFor 0, "seconds"
   cacheChangingModulesFor 0, 'seconds'
  }
 }
  dependencies {
        // transitive way
 compile group: 'com.test.eclipse', name: 'eclipse-java', version: '5.0.1.Beta3-SNAPSHOT'
           // direct dependency
 //compile group: 'com.test.mongo', name: 'mongo-java', version: '5.0.1.Beta3-SNAPSHOT'
}
  //...

Repro steps : * go to the artifact/version folder of mongo-java in the gradle cache * delete all folders * run “gradlew eclipse -x test” on eclipse-java ** refresh mongo-java cache folder ** in that folder you should see 3 folders (one for jar, sources and pom) * upload mongo-java dependency on the repository ** jar, sources, javadoc and pom are transferred ** md5 and sha-1 checksum changed (we validated on artifactory) * “run gradlew eclipse -x test” ** in the cache folder you should see 4 folders (2 for jar, 1 sources and 1 pom) ** jar artifact is up-to-date ** sources jar weren’t updated


(Daniel Marcotte) #2

I have the same problem, must often wipe out the .gradle folder that contains the cache of my artifacts.


#3

I’m pretty sure the issue is that the Eclipse plugin ignores your ‘resolutionStrategy’ settings when downloading source and javadoc artifacts. If this is the case, the sources artifact would be updated after 24 hours, but not every time they are published.

I’ve raised GRADLE-3139 for this issue.