How to determine the time of an item in dependency cache?

I am looking to display the time/date of an item in the dependency cache.

I suspect this piece of information is in the DSL manual or API and have looked but am not finding it.

Still a DSL/API ‘noob’

I am looking for a property or method ‘xXXXX’ as below.

configurations.runtime.each {

if ( it.name.contains(installerName)) {

logger.info “-- Identified dependency: $it”

logger.info "-- Time/date of creation in cache: ${it.xXXX} "

}

}

Thanks for any help

I don’t think there is anything on the API that will give you this information. The closest approximation that might work is to look at creation date of the cached file, but this won’t tell you when Gradle last checked to see if it was up-to-date.

What problem are you trying to solve with this information?

Thanks so much for the quick reply.

I continue to be impressed with Gradle.

The real issue is ensuring that our “legacy” maven 1 dependency downloads are happening (hence my thought of displaying the time as a diagnostic). Similarly to maven, I want to download the SNAPSHOT dependency (500 MB) that is newer (yet NOT download anything NOT a SNAPSHOT. )

Do I have the following code snippet correct to implement the above?

We are running Gradle 1.2

Thank you for any help.

: : :

configurations.all {

resolutionStrategy.cacheChangingModulesFor 0, ‘minutes’ }

repositories {

maven {

url “http://mycompany.com/maven/

} }

dependencies {

runtime group: ‘my-installer’, name: installerName, version: installerVersion, ext: ‘jar’, changing: true

// SNAPSHOTs are changing }

Similarly to maven, I want to download the SNAPSHOT dependency (500 MB) that is newer (yet NOT download anything NOT a SNAPSHOT. )

Gradle will do this automatically, except that by default it will cache SNAPSHOT dependencies for 24 hours. (Gradle recognises SNAPSHOT dependencies by name and automatically flags them as “changing”).

So the only special configuration you’ll need is:

configurations.all {
    resolutionStrategy.cacheChangingModulesFor 0, 'minutes'
}

So maybe I just need to learn to trust.

:slight_smile:

Thanks!!!