[GRADLE-750] Cache is not updated based on build file changes Created: 19/Nov/09  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.8
Fix Version/s: None

Type: Bug
Reporter: Ken Sipe Assignee: Unassigned
Resolution: Won't Fix Votes: 5


 Description   

I was converting a maven pom over to gradle (love gradle...), in the process the maven pom had references to a spring dependency (like put the gradle file at the end of this report). The compile failed with the same configuration. It turns out that it is because of the transitive configuration on the dependencies. so I add configurations.compile.transitive = true to my build file. Should work.. but it didn't. In the end, I deleted the cache (in ~/.gradle), then it worked great. Then for kicks I looked at the configuration info (which jars are at compile and runtime). I switched back to the configurations.compile.transitive = false and reran the task for observing the jars... it was the same jars. If I delete the cache, then it changes and it is back to one jar.

I would expect that the cache is for ALL build files... I think you have to bring down the configurations.compile.transitive = true configurations to the cache (you can't expect that all builds will only use the default configuration of transitive = false)... then each build needs to read from the cache if it needs the extra dependencies or not. This seems like a pretty big issue.

Here is the build file I am using. Feel free to ping me if you need more details. I'm @kensipe on twitter. I would also be willing to send you the whole project... it is only a demo project, however my explanation should be verbose enough and it fails for all projects.

<build.gradle>
usePlugin 'java'

repositories {
mavenCentral()
mavenRepo urls: 'http://maven.springframework.org/milestone'
}

configurations.compile.transitive = true

task show << {
println "compile: " + configurations.compile.files
println "runtime: " + configurations.runtime.files
println configurations.testCompile.files
println configurations.testRuntime.files
}

dependencies {
compile 'org.springframework:spring-webmvc:3.0.0.RC2'
/* compile 'org.springframework:spring-web:3.0.0.RC2'
compile 'org.springframework:spring-context:3.0.0.RC2'*/

testCompile 'org.springframework:spring-test:3.0.0.RC2'
testCompile 'junit:junit:4.7'
}



 Comments   
Comment by Ken Sipe [ 19/Nov/09 ]

I've now tested with -C rebuild and this works fine. So there was no need for me to delete my cache. Perhaps this was my issue... I am now doing a clean compile... that seems to work with the changes mentioned in this bug. There still seems to be a bug here. There just seems to be some work arounds.

Comment by Marc Guillemot [ 19/Apr/10 ]

I have a similar problem with 0.9-preview-1: while I'm developing my build scripts, it often appears that my changes are not really taken into account or that strange things occur. I first get the expected results when I delete the .gradle folder(s).

Here an illustration of the problem:

  1. gradle clean foo:test
    :shared:testutils:clean
    :foo:clean
    :shared:clean UP-TO-DATE
    :shared:testutils:compileJava
    :foo:compileJava UP-TO-DATE <--- here it shouldn't be UP-TO-DATE as it as been cleared
    :shared:testutils:processResources
    ...

this leads to failures later, like test classes that can't find main classes as they haven't been compiled.

I fully agree on the severity of this issue.

Comment by Moritz Baumann [ 28/May/15 ]

This issue is still present on 2.4 and very severe, especially if you play around with complex build configurations, since you can never be sure whether gradle or your changes are the actual problem.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:37:54 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.