On Tue, Mar 8, 2011 at 3:51 AM, Adam Murdoch <[email protected]>wrote:
> > On 08/03/2011, at 2:29 AM, Brett Cave wrote: > > Hi, > > I still get behaviour similar to this: > http://gradle.1045684.n5.nabble.com/Snapshot-dependencies-not-updated-td1433032.htmlin > gradle 1 m1 - is this behaviour normal / expected? > > > The default behaviour for a maven repo is to check for new snapshots once a > day. You can change the strategy on a per-repository basis: > > mavenRepo(urls: '...') { > // Always check for new snapshots > snapshotTimeout = 0 > } > > Or you can set changing = true on the particular dependency. > There definitely seems to be a problem with fetching latest versions of snapshots. The producer project creates 2 artifacts - 1 is a jar, and the other is a .tar file. In the uploadArchives task, both files are updated, and can be seen in the local repository (artifactory). In 1 consumer project, I reference both the tar artifacts, and another references the jar dependencies { customConfig ("com.mycompany.package:some-model:$modelVersion@tar") { changing = true } } task extractTar(type: Copy) { into "somedir" configurations.customConfig.each { tarTree(it) } } and the other consumer (a different project in the same multi-project build): dependencies { compile ("com.mycompany.package:some-model:$modelVersion") { changing = true } } The following is in ~/.gradle/cache/com.mycompany.package/some-model/ivydata-2.0.0-SNAPSHOT.properties: #ivy cached data file for com.jemstep.commons#jemstep-model;2.0.0-SNAPSHOT #Tue Mar 15 10:52:02 SAST 2011 artifact\:some-model\#jar\#jar\#-618717795.is-local=false resolver=repo artifact\:some-model\#pom.original\#pom\#1033844867.is-local=false artifact.resolver=repo artifact\:some-model\#pom.original\#pom\#1033844867.location=http\://artifactory.local/artifactory/repo/com/mycompany/package/some-model/2.0.0-SNAPSHOT/some-model-2.0.0-20110315.071638-32.pom artifact\:some-model\#tar\#tar\#-605561705.location=http\://artifactory.local/artifactory/repo/com/mycompany/package/some-model/2.0.0-SNAPSHOT/some-model-2.0.0-20110311.143737-24.tar artifact\:ivy\#ivy\#xml\#1579040360.is-local=false artifact\:ivy\#ivy\#xml\#1579040360.location=http\://artifactory.local/artifactory/repo/com/mycompany/package/some-model/2.0.0-SNAPSHOT/some-model-2.0.0-20110315.071638-32.pom artifact\:some-model\#tar\#tar\#-605561705.is-local=false artifact\:some-model\#jar\#jar\#-618717795.location=http\://artifactory.local/artifactory/repo/com/mycompany/package/some-model/2.0.0-SNAPSHOT/some-model-2.0.0-20110315.071638-32.jar So the jar file is -32, but the tar file stays at -24, even though both are declared as { changing = true } in dependencies (the jar dependency is in the compile configuration, the tar is in a custom configuration). During the consumer's build process, i can see the pom and jar being downloaded, but the tar is not requested (as confirmed from the artifactory logs) :consumer-client:extractTar :consumer-client:compileJava Download http://artifactory.local/artifactory/repo/com/mycompany/package/some-other/2.0.0-SNAPSHOT/some-other-2.0.0-20110315.071642-82.pom Download http://artifactory.local/artifactory/repo/com/mycompany/package/some-other/2.0.0-SNAPSHOT/some-other-2.0.0-20110315.071642-82.jar // Compile failure due to old -model file here. "some-other" is a different project from the same multi-project build that produces model. i also have a "consumer-server" project that has a dependency on ("com.mycompany.package:some-model:$modelVersion") { changing = true } and new versions are retrieved on each build (but in thhis instance, the multi project build fails at the -client project and does not make it to the -server project). > > > > My ~/.gradle/init.gradle: > addListener(new ArtifactoryGradleSettings()) > class ArtifactoryGradleSettings extends BuildAdapter implements > BuildListener { > > def void projectsLoaded(Gradle gradle) { > Project root = gradle.getRootProject() > root.allprojects { > > buildscript { > repositories { > > org.apache.ivy.util.url.CredentialsStore.INSTANCE.addCredentials(artifactoryRealm, > artifactoryHost, artifactoryUsername, artifactoryPassword); > mavenRepo name: 'plugins', urls: " > http://artifactory.local/artifactory/plugins" > } > } > > repositories { > mavenRepo name: 'repo', urls: " > http://artifactory.local/artifactory/repo" > } > } > } > } > > > My project's build.gradle: > configurations { > the_tar > } > dependencies { > def commonsVersion = "2.0.0-SNAPSHOT" > the_tar "com.mycompany.commons:my-model:$commonsVersion@tar" > } > > task getTheTar(type: Copy) { > into "$projectDir/src/main" > configurations.the_tar.findAll{it.name.endsWith('.tar')}.each { > from tarTree(it) > } > include "resources/**/*.def" > } > > > The tar is not fetched (after about 6 rebuilds so far, with "-C rebuild" > set). It fetches a new one if changing=true is set. > > > > -- > Adam Murdoch > Gradle Developer > http://www.gradle.org > Co-Founder and VP of Engineering, Gradleware Inc. - Gradle Training, > Support, Consulting > http://www.gradleware.com > > -- Brett Cave Systems Architect Jemstep, Inc www.jemstep.com
