[GRADLE-3216] Using changing provided by component metadata rule for latest.release fails to resolve module Created: 16/Dec/14 Updated: 19/Mar/15 Resolved: 19/Mar/15 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 2.0 |
Fix Version/s: | 2.4-rc-1 |
Type: | Bug | ||
Reporter: | Benjamin Muschko | Assignee: | Benjamin Muschko |
Resolution: | Fixed | Votes: | 0 |
Issue Links: |
|
Description |
In the following build script, we try to resolve the latest release version of a dependency from an Ivy repository. The dependency can have one of the statuses "snapshot" or "release". The snapshot version indicates a changing version. The changing flag is set by a component metadata rule. The TTL for changing versions is set to 0 seconds. repositories { ivy { url "..." } } configurations { compile } dependencies { compile 'org.test:projectA:latest.release' components { all { ComponentMetadataDetails details -> if(details.status == 'snapshot') { details.changing = true } details.statusScheme = ['snapshot', 'release'] } } } configurations.all { resolutionStrategy { cacheChangingModulesFor 0, 'seconds' } } task retrieve(type: Sync) { from configurations.compile into 'libs' } The first resolution of the dependency works fine. On every succeeding resolution, Gradle fails with the following exception: Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.test:projectA:latest.release. Required by: :unknown-test-126:unspecified at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver.resolve(DynamicVersionResolver.java:74) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainAdapter.resolve(RepositoryChainAdapter.java:52) at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:48) at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:50) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:881) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:228) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:115) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:90) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:80) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:122) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:88) at org.gradle.internal.Transformers$4.transform(Transformers.java:137) at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61) at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39) at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:88) at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:192) at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175) at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106) at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187) at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64) at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40) at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:45) at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:55) at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:47) at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:46) at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:250) at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:240) at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:442) ... 45 more Caused by: java.lang.IllegalStateException: This module has not been resolved. at org.gradle.internal.resolve.result.DefaultBuildableModuleComponentMetaDataResolveResult.assertResolved(DefaultBuildableModuleComponentMetaDataResolveResult.java:94) at org.gradle.internal.resolve.result.DefaultBuildableModuleComponentMetaDataResolveResult.getMetaData(DefaultBuildableModuleComponentMetaDataResolveResult.java:69) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser$MetaDataSupplier.create(NewestVersionComponentChooser.java:132) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser$MetaDataSupplier.create(NewestVersionComponentChooser.java:118) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.MetadataProvider.getMetaData(MetadataProvider.java:51) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.MetadataProvider.getComponentMetadata(MetadataProvider.java:37) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.versionMatches(NewestVersionComponentChooser.java:98) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.choose(NewestVersionComponentChooser.java:83) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver$RepositoryResolveState.resolveDependency(DynamicVersionResolver.java:184) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver$RepositoryResolveState.process(DynamicVersionResolver.java:175) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver$RepositoryResolveState.resolve(DynamicVersionResolver.java:158) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver.findLatestModule(DynamicVersionResolver.java:106) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver.findLatestModule(DynamicVersionResolver.java:90) at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DynamicVersionResolver.resolve(DynamicVersionResolver.java:63) ... 74 more This works fine if the command line option --refresh-dependencies is used. |