I'm trying to find the latest version of the module I'm current builds, to determine what version I should use. There's some business logic around actually picking the next version, but first I have to get it. In Ivy, I could ask the RepositoryResolver to list of revisions. I'm trying to find a Gradle equivalent, so I created a detached configuration with a single dependency of the current project and tried to resolve it. Nope. That results in a "Unexpected root id" exception. I have plans to do jdiff like report based on the previous version of the current module, but I can never do that if I can't resolve a configuration to find it.
This seems like a bug. Below is a sample that shows that a detached conf works find for some other module, but not myself. findLatest will fail, and findLatestJunit will work fine.
repositories {
mavenCentral()
}
group = 'commons-logging'
task findLatest << {
def d = dependencies.create(group: project.group, name: project.name, version: '+')
def c = configurations.detachedConfiguration(d).setTransitive(false)
println c.resolvedConfiguration.firstLevelModuleDependencies
}
task findLatestJunit << {
def d = dependencies.create(group: 'junit', name: 'junit', version: '+')
def c = configurations.detachedConfiguration(d).setTransitive(false)
println c.resolvedConfiguration.firstLevelModuleDependencies
}
The exception:
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration 'detachedConfiguration1'.
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.wrapException(ErrorHandlingArtifactDependencyResolver.java:57)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.access$000(ErrorHandlingArtifactDependencyResolver.java:34)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFirstLevelModuleDependencies(ErrorHandlingArtifactDependencyResolver.java:194)
at build_6s50q9miouadc8tvcp493ns1ue$_run_closure2.doCall(/Users/jryan/Projects/detachedproblem/build.gradle:11)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:496)
at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:477)
at org.gradle.api.internal.tasks.TaskStatusNagger$1.execute(TaskStatusNagger.java:77)
at org.gradle.api.internal.tasks.TaskStatusNagger$1.execute(TaskStatusNagger.java:73)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 70 more
Caused by: java.lang.RuntimeException: Problems reading data from Binary store in /private/var/folders/2q/nkf8g47s4k50hbn2q633q0ww_yp9s1/T/gradle8648575764113211065.bin (exist: true)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:119)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore$3.create(TransientResultsStore.java:105)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore$3.create(TransientResultsStore.java:102)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.CachedStoreFactory$SimpleStore.load(CachedStoreFactory.java:95)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore.load(TransientResultsStore.java:102)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.DefaultResolvedConfigurationBuilder.more(DefaultResolvedConfigurationBuilder.java:96)
at org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration.getFirstLevelModuleDependencies(DefaultLenientConfiguration.java:155)
at org.gradle.api.internal.artifacts.ivyservice.DefaultResolvedConfiguration.getFirstLevelModuleDependencies(DefaultResolvedConfiguration.java:50)
at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver$FilesAggregatingResolvedConfiguration.getFirstLevelModuleDependencies(SelfResolvingDependencyResolver.java:90)
at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver$ErrorHandlingResolvedConfiguration.getFirstLevelModuleDependencies(ErrorHandlingArtifactDependencyResolver.java:192)
... 77 more
Caused by: java.lang.IllegalStateException: Unexpected root id commons-logging:commons-logging:unspecified:detachedConfiguration1. Seen ids: []
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore.deserialize(TransientResultsStore.java:138)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore.access$100(TransientResultsStore.java:40)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore$3$1.read(TransientResultsStore.java:107)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.oldresult.TransientResultsStore$3$1.read(TransientResultsStore.java:105)
at org.gradle.api.internal.artifacts.ivyservice.resolveengine.store.DefaultBinaryStore$SimpleBinaryData.read(DefaultBinaryStore.java:117)
... 86 more
|