Testing ComponentSelection

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Testing ComponentSelection

Lóránt Pintér-2
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{<a href="http://prezi.com/gradle/boxfish}branches">http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{<a href="http://prezi.com/gradle/boxfish}branches">http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{<a href="http://prezi.com/gradle/boxfish}branches">http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{<a href="http://prezi.com/gradle/boxfish}branches">http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi

Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Gary Hale
Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi


Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Lóránt Pintér
Hey Gary,

This makes a lot of sense, however, when I re-run the build with --debug, there is no exception in the log. Is it still possible that there is an exception? If so, how would you detect it?

Lóránt


On Tue, Sep 2, 2014 at 12:20 AM, Gary Hale <[hidden email]> wrote:

Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi



Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Lóránt Pintér
In reply to this post by Gary Hale
I found the exception. It happens right after the first candidate has been rejected, while running the rules against the second candidate.

And indeed I can see all the candidates I’d expect in `versions` at https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/NewestVersionComponentChooser.java#L74-L88

Here’s the exception:


00:35:00.799 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.prezi.test.target:boxfish-test-target:1.+' using repositories [ivyLocal, ivy, maven]
00:35:03.952 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] Branch is master
00:35:03.955 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] {http://prezi.com/gradle/boxfish}branches = master,test-branch
00:35:06.546 [INFO] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor] Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can
00:37:59.324 [ERROR] [system.err] java.lang.IllegalStateException: This module has not been resolved.
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.assertResolved(DefaultBuildableModuleVersionMetaDataResolveResult.java:87)
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.getMetaData(DefaultBuildableModuleVersionMetaDataResolveResult.java:72)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.initMetaData(ComponentSelectionRulesProcessor.java:137)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getMetaData(ComponentSelectionRulesProcessor.java:128)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getIvyModuleDescriptor(ComponentSelectionRulesProcessor.java:118)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRule(ComponentSelectionRulesProcessor.java:84)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRules(ComponentSelectionRulesProcessor.java:62)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.apply(ComponentSelectionRulesProcessor.java:56)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.isRejectedByRules(NewestVersionComponentChooser.java:107)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.choose(NewestVersionComponentChooser.java:81)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.resolveDependency(RepositoryChainDependencyResolver.java:246)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.process(RepositoryChainDependencyResolver.java:233)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$RepositoryResolveState.resolve(RepositoryChainDependencyResolver.java:177)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:121)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:97)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.resolve(RepositoryChainDependencyResolver.java:66)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:48)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:49)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:70)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver.resolve(LazyDependencyToModuleResolver.java:47)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:48)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:843)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:227)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:114)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:89)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:125)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:89)
00:37:59.334 [ERROR] [system.err] at org.gradle.internal.Transformers$3.transform(Transformers.java:131)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:89)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42)
00:37:59.336 [ERROR] [system.err] at org.gradle.internal.Factories$1.create(Factories.java:22)
00:37:59.336 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:45)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:55)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:47)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:46)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:243)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:233)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:591)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:588)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
00:37:59.340 [ERROR] [system.err] at com.prezi.spaghetti.gradle.ObfuscateModule_Decorated.getAdditionalDirectDependentModules(Unknown Source)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.341 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.341 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.341 [ERROR] [system.err] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:452)
00:37:59.341 [ERROR] [system.err] at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:160)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:450)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$1.call(AnnotationProcessingTaskFactory.java:254)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:120)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext$BuildableFileTreeInternalConverter.convertInto(BuildDependenciesOnlyFileCollectionResolveContext.java:50)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext.resolveAsBuildables(BuildDependenciesOnlyFileCollectionResolveContext.java:43)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection.addDependencies(CompositeFileCollection.java:136)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection$3.resolve(CompositeFileCollection.java:124)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:86)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:200)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:112)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:64)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.doResolve(CachingTaskDependencyResolveContext.java:74)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.resolve(CachingTaskDependencyResolveContext.java:63)
00:37:59.345 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:53)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.addToTaskGraph(DefaultTaskExecutionPlan.java:106)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:76)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:47)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:46)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:39)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
00:37:59.348 [ERROR] [system.err] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.Main.doAction(Main.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.350 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.351 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.351 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.352 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)


Lóránt


On Tue, Sep 2, 2014 at 12:20 AM, Gary Hale <[hidden email]> wrote:

Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi



Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Lóránt Pintér
One thing that might not be related, but still sounds like a bug: DefaultResolutionStrategy.copy() does not copy the componentSelectionRules (while it does copy all the other rules).

Lóránt


On Tue, Sep 2, 2014 at 12:42 AM, Lóránt Pintér <[hidden email]> wrote:

I found the exception. It happens right after the first candidate has been rejected, while running the rules against the second candidate.

And indeed I can see all the candidates I’d expect in `versions` at https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/NewestVersionComponentChooser.java#L74-L88

Here’s the exception:


00:35:00.799 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.prezi.test.target:boxfish-test-target:1.+' using repositories [ivyLocal, ivy, maven]
00:35:03.952 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] Branch is master
00:35:03.955 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] {http://prezi.com/gradle/boxfish}branches = master,test-branch
00:35:06.546 [INFO] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor] Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can
00:37:59.324 [ERROR] [system.err] java.lang.IllegalStateException: This module has not been resolved.
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.assertResolved(DefaultBuildableModuleVersionMetaDataResolveResult.java:87)
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.getMetaData(DefaultBuildableModuleVersionMetaDataResolveResult.java:72)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.initMetaData(ComponentSelectionRulesProcessor.java:137)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getMetaData(ComponentSelectionRulesProcessor.java:128)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getIvyModuleDescriptor(ComponentSelectionRulesProcessor.java:118)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRule(ComponentSelectionRulesProcessor.java:84)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRules(ComponentSelectionRulesProcessor.java:62)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.apply(ComponentSelectionRulesProcessor.java:56)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.isRejectedByRules(NewestVersionComponentChooser.java:107)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.choose(NewestVersionComponentChooser.java:81)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.resolveDependency(RepositoryChainDependencyResolver.java:246)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.process(RepositoryChainDependencyResolver.java:233)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$RepositoryResolveState.resolve(RepositoryChainDependencyResolver.java:177)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:121)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:97)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.resolve(RepositoryChainDependencyResolver.java:66)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:48)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:49)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:70)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver.resolve(LazyDependencyToModuleResolver.java:47)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:48)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:843)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:227)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:114)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:89)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:125)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:89)
00:37:59.334 [ERROR] [system.err] at org.gradle.internal.Transformers$3.transform(Transformers.java:131)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:89)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42)
00:37:59.336 [ERROR] [system.err] at org.gradle.internal.Factories$1.create(Factories.java:22)
00:37:59.336 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:45)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:55)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:47)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:46)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:243)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:233)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:591)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:588)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
00:37:59.340 [ERROR] [system.err] at com.prezi.spaghetti.gradle.ObfuscateModule_Decorated.getAdditionalDirectDependentModules(Unknown Source)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.341 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.341 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.341 [ERROR] [system.err] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:452)
00:37:59.341 [ERROR] [system.err] at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:160)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:450)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$1.call(AnnotationProcessingTaskFactory.java:254)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:120)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext$BuildableFileTreeInternalConverter.convertInto(BuildDependenciesOnlyFileCollectionResolveContext.java:50)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext.resolveAsBuildables(BuildDependenciesOnlyFileCollectionResolveContext.java:43)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection.addDependencies(CompositeFileCollection.java:136)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection$3.resolve(CompositeFileCollection.java:124)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:86)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:200)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:112)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:64)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.doResolve(CachingTaskDependencyResolveContext.java:74)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.resolve(CachingTaskDependencyResolveContext.java:63)
00:37:59.345 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:53)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.addToTaskGraph(DefaultTaskExecutionPlan.java:106)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:76)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:47)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:46)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:39)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
00:37:59.348 [ERROR] [system.err] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.Main.doAction(Main.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.350 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.351 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.351 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.352 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)


Lóránt


On Tue, Sep 2, 2014 at 12:20 AM, Gary Hale <[hidden email]> wrote:

Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi




Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Lóránt Pintér
I checked, and if componentSelectionRules are copied, the problem goes away, and I get the expected result of all my versions listed as candidates. The error I get in the end is now also correct:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':modules'.
> Could not find any version that matches com.prezi.test.target:boxfish-test-target:1.+.
  Required by:
      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

I’ve created a pull request for the fix:
https://github.com/gradle/gradle/pull/324



Lóránt


On Tue, Sep 2, 2014 at 1:05 AM, Lóránt Pintér <[hidden email]> wrote:

One thing that might not be related, but still sounds like a bug: DefaultResolutionStrategy.copy() does not copy the componentSelectionRules (while it does copy all the other rules).

Lóránt


On Tue, Sep 2, 2014 at 12:42 AM, Lóránt Pintér <[hidden email]> wrote:

I found the exception. It happens right after the first candidate has been rejected, while running the rules against the second candidate.

And indeed I can see all the candidates I’d expect in `versions` at https://github.com/gradle/gradle/blob/master/subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/NewestVersionComponentChooser.java#L74-L88

Here’s the exception:


00:35:00.799 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.prezi.test.target:boxfish-test-target:1.+' using repositories [ivyLocal, ivy, maven]
00:35:03.952 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] Branch is master
00:35:03.955 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] {http://prezi.com/gradle/boxfish}branches = master,test-branch
00:35:06.546 [INFO] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor] Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can
00:37:59.324 [ERROR] [system.err] java.lang.IllegalStateException: This module has not been resolved.
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.assertResolved(DefaultBuildableModuleVersionMetaDataResolveResult.java:87)
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.getMetaData(DefaultBuildableModuleVersionMetaDataResolveResult.java:72)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.initMetaData(ComponentSelectionRulesProcessor.java:137)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getMetaData(ComponentSelectionRulesProcessor.java:128)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getIvyModuleDescriptor(ComponentSelectionRulesProcessor.java:118)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRule(ComponentSelectionRulesProcessor.java:84)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRules(ComponentSelectionRulesProcessor.java:62)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.apply(ComponentSelectionRulesProcessor.java:56)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.isRejectedByRules(NewestVersionComponentChooser.java:107)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.choose(NewestVersionComponentChooser.java:81)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.resolveDependency(RepositoryChainDependencyResolver.java:246)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.process(RepositoryChainDependencyResolver.java:233)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$RepositoryResolveState.resolve(RepositoryChainDependencyResolver.java:177)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:121)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:97)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.resolve(RepositoryChainDependencyResolver.java:66)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:48)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:49)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:70)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver.resolve(LazyDependencyToModuleResolver.java:47)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:48)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:843)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:227)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:114)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:89)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:125)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:89)
00:37:59.334 [ERROR] [system.err] at org.gradle.internal.Transformers$3.transform(Transformers.java:131)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:89)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42)
00:37:59.336 [ERROR] [system.err] at org.gradle.internal.Factories$1.create(Factories.java:22)
00:37:59.336 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:45)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:55)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:47)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:46)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:243)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:233)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:591)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:588)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
00:37:59.340 [ERROR] [system.err] at com.prezi.spaghetti.gradle.ObfuscateModule_Decorated.getAdditionalDirectDependentModules(Unknown Source)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.341 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.341 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.341 [ERROR] [system.err] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:452)
00:37:59.341 [ERROR] [system.err] at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:160)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:450)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$1.call(AnnotationProcessingTaskFactory.java:254)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:120)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext$BuildableFileTreeInternalConverter.convertInto(BuildDependenciesOnlyFileCollectionResolveContext.java:50)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext.resolveAsBuildables(BuildDependenciesOnlyFileCollectionResolveContext.java:43)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection.addDependencies(CompositeFileCollection.java:136)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection$3.resolve(CompositeFileCollection.java:124)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:86)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:200)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:112)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:64)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.doResolve(CachingTaskDependencyResolveContext.java:74)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.resolve(CachingTaskDependencyResolveContext.java:63)
00:37:59.345 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:53)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.addToTaskGraph(DefaultTaskExecutionPlan.java:106)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:76)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:47)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:46)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:39)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
00:37:59.348 [ERROR] [system.err] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.Main.doAction(Main.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.350 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.351 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.351 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.352 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)


Lóránt


On Tue, Sep 2, 2014 at 12:20 AM, Gary Hale <[hidden email]> wrote:

Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi





Reply | Threaded
Open this post in threaded view
|

Re: Testing ComponentSelection

Gary Hale
Thanks, Lorant.  I'll take a look and merge it in.

Gary


On Mon, Sep 1, 2014 at 7:35 PM, Lóránt Pintér <[hidden email]> wrote:
I checked, and if componentSelectionRules are copied, the problem goes away, and I get the expected result of all my versions listed as candidates. The error I get in the end is now also correct:

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration ':modules'.
> Could not find any version that matches com.prezi.test.target:boxfish-test-target:1.+.
  Required by:
      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

I’ve created a pull request for the fix:

Lóránt


On Tue, Sep 2, 2014 at 1:05 AM, Lóránt Pintér <[hidden email]> wrote:

One thing that might not be related, but still sounds like a bug: DefaultResolutionStrategy.copy() does not copy the componentSelectionRules (while it does copy all the other rules).

Lóránt


On Tue, Sep 2, 2014 at 12:42 AM, Lóránt Pintér <[hidden email]> wrote:

I found the exception. It happens right after the first candidate has been rejected, while running the rules against the second candidate.


Here’s the exception:


00:35:00.799 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver] Attempting to resolve module 'com.prezi.test.target:boxfish-test-target:1.+' using repositories [ivyLocal, ivy, maven]
00:35:03.952 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] Branch is master
00:35:03.955 [INFO] [com.prezi.gradle.boxfish.BoxfishPlugin] {http://prezi.com/gradle/boxfish}branches = master,test-branch
00:35:06.546 [INFO] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor] Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can
00:37:59.324 [ERROR] [system.err] java.lang.IllegalStateException: This module has not been resolved.
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.assertResolved(DefaultBuildableModuleVersionMetaDataResolveResult.java:87)
00:37:59.327 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.DefaultBuildableModuleVersionMetaDataResolveResult.getMetaData(DefaultBuildableModuleVersionMetaDataResolveResult.java:72)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.initMetaData(ComponentSelectionRulesProcessor.java:137)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getMetaData(ComponentSelectionRulesProcessor.java:128)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor$MetadataProvider.getIvyModuleDescriptor(ComponentSelectionRulesProcessor.java:118)
00:37:59.328 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRule(ComponentSelectionRulesProcessor.java:84)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.processRules(ComponentSelectionRulesProcessor.java:62)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ComponentSelectionRulesProcessor.apply(ComponentSelectionRulesProcessor.java:56)
00:37:59.329 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.isRejectedByRules(NewestVersionComponentChooser.java:107)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.NewestVersionComponentChooser.choose(NewestVersionComponentChooser.java:81)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.resolveDependency(RepositoryChainDependencyResolver.java:246)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$DynamicVersionRepositoryResolveState.process(RepositoryChainDependencyResolver.java:233)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver$RepositoryResolveState.resolve(RepositoryChainDependencyResolver.java:177)
00:37:59.330 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:121)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.findLatestModule(RepositoryChainDependencyResolver.java:97)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainDependencyResolver.resolve(RepositoryChainDependencyResolver.java:66)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.clientmodule.ClientModuleResolver.resolve(ClientModuleResolver.java:48)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyResolver.resolve(ProjectDependencyResolver.java:49)
00:37:59.331 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:70)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver.resolve(LazyDependencyToModuleResolver.java:47)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.VersionForcingDependencyToModuleResolver.resolve(VersionForcingDependencyToModuleResolver.java:48)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolveModuleRevisionId(DependencyGraphBuilder.java:843)
00:37:59.332 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder$DependencyEdge.resolveModuleRevisionId(DependencyGraphBuilder.java:227)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:114)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolveDependencyGraph(DependencyGraphBuilder.java:89)
00:37:59.333 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:79)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:125)
00:37:59.334 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver$1.execute(DefaultDependencyResolver.java:89)
00:37:59.334 [ERROR] [system.err] at org.gradle.internal.Transformers$3.transform(Transformers.java:131)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:61)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultIvyContextManager.withIvy(DefaultIvyContextManager.java:39)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:89)
00:37:59.335 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver$1.run(CacheLockingArtifactDependencyResolver.java:42)
00:37:59.336 [ERROR] [system.err] at org.gradle.internal.Factories$1.create(Factories.java:22)
00:37:59.336 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheAccess.useCache(DefaultCacheAccess.java:175)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultPersistentDirectoryStore.useCache(DefaultPersistentDirectoryStore.java:106)
00:37:59.337 [ERROR] [system.err] at org.gradle.cache.internal.DefaultCacheFactory$ReferenceTrackingCache.useCache(DefaultCacheFactory.java:187)
00:37:59.337 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultCacheLockingManager.useCache(DefaultCacheLockingManager.java:64)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.CacheLockingArtifactDependencyResolver.resolve(CacheLockingArtifactDependencyResolver.java:40)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.SelfResolvingDependencyResolver.resolve(SelfResolvingDependencyResolver.java:45)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ShortcircuitEmptyConfigsArtifactDependencyResolver.resolve(ShortcircuitEmptyConfigsArtifactDependencyResolver.java:55)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.ErrorHandlingArtifactDependencyResolver.resolve(ErrorHandlingArtifactDependencyResolver.java:47)
00:37:59.338 [ERROR] [system.err] at org.gradle.api.internal.artifacts.ivyservice.DefaultConfigurationResolver.resolve(DefaultConfigurationResolver.java:46)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.resolveNow(DefaultConfiguration.java:243)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.getResolvedConfiguration(DefaultConfiguration.java:233)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration_Decorated.getResolvedConfiguration(Unknown Source)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:591)
00:37:59.339 [ERROR] [system.err] at com.prezi.gradle.boxfish.BoxfishPlugin$PrideTransitiveOverridesFix$1$2.call(BoxfishPlugin.java:588)
00:37:59.339 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$2.getValue(ConventionAwareHelper.java:84)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper$MappedPropertyImpl.getValue(ConventionAwareHelper.java:136)
00:37:59.340 [ERROR] [system.err] at org.gradle.api.internal.ConventionAwareHelper.getConventionValue(ConventionAwareHelper.java:114)
00:37:59.340 [ERROR] [system.err] at com.prezi.spaghetti.gradle.ObfuscateModule_Decorated.getAdditionalDirectDependentModules(Unknown Source)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.340 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.341 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.341 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.341 [ERROR] [system.err] at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo$4.create(AnnotationProcessingTaskFactory.java:452)
00:37:59.341 [ERROR] [system.err] at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:160)
00:37:59.341 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$PropertyInfo.getValue(AnnotationProcessingTaskFactory.java:450)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$Validator$1.call(AnnotationProcessingTaskFactory.java:254)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:120)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileTrees(DefaultFileCollectionResolveContext.java:75)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext$BuildableFileTreeInternalConverter.convertInto(BuildDependenciesOnlyFileCollectionResolveContext.java:50)
00:37:59.342 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.doResolve(DefaultFileCollectionResolveContext.java:98)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.DefaultFileCollectionResolveContext.resolveAsFileCollections(DefaultFileCollectionResolveContext.java:82)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.collections.BuildDependenciesOnlyFileCollectionResolveContext.resolveAsBuildables(BuildDependenciesOnlyFileCollectionResolveContext.java:43)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection.addDependencies(CompositeFileCollection.java:136)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.file.CompositeFileCollection$3.resolve(CompositeFileCollection.java:124)
00:37:59.343 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext$TaskGraphImpl.getNodeValues(CachingTaskDependencyResolveContext.java:86)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker$GraphWithEmpyEdges.getNodeValues(CachingDirectedGraphWalker.java:200)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.doSearch(CachingDirectedGraphWalker.java:112)
00:37:59.344 [ERROR] [system.err] at org.gradle.internal.graph.CachingDirectedGraphWalker.findValues(CachingDirectedGraphWalker.java:64)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.doResolve(CachingTaskDependencyResolveContext.java:74)
00:37:59.344 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.resolve(CachingTaskDependencyResolveContext.java:63)
00:37:59.345 [ERROR] [system.err] at org.gradle.api.internal.tasks.CachingTaskDependencyResolveContext.getDependencies(CachingTaskDependencyResolveContext.java:53)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.addToTaskGraph(DefaultTaskExecutionPlan.java:106)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.addTasks(DefaultTaskGraphExecuter.java:76)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.TaskNameResolvingBuildConfigurationAction.configure(TaskNameResolvingBuildConfigurationAction.java:47)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.345 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.ExcludedTaskFilteringBuildConfigurationAction.configure(ExcludedTaskFilteringBuildConfigurationAction.java:46)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.access$100(DefaultBuildExecuter.java:23)
00:37:59.346 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:48)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultTasksBuildExecutionAction.configure(DefaultTasksBuildExecutionAction.java:39)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.configure(DefaultBuildExecuter.java:42)
00:37:59.347 [ERROR] [system.err] at org.gradle.execution.DefaultBuildExecuter.select(DefaultBuildExecuter.java:35)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
00:37:59.347 [ERROR] [system.err] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
00:37:59.348 [ERROR] [system.err] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
00:37:59.348 [ERROR] [system.err] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
00:37:59.349 [ERROR] [system.err] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.Main.doAction(Main.java:33)
00:37:59.350 [ERROR] [system.err] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.350 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.350 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.351 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
00:37:59.351 [ERROR] [system.err] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
00:37:59.351 [ERROR] [system.err] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
00:37:59.351 [ERROR] [system.err] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
00:37:59.352 [ERROR] [system.err] at java.lang.reflect.Method.invoke(Method.java:483)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
00:37:59.352 [ERROR] [system.err] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)


Lóránt


On Tue, Sep 2, 2014 at 12:20 AM, Gary Hale <[hidden email]> wrote:

Lorant,

I've not been able to reproduce this behavior.  One thing that jumps out at me is that the error is not what you would expect for a failure when it can't find a version.  If it checked all versions and did not find a match, you would see something like:

Execution failed for task ':resolveConf'.
> Could not resolve all dependencies for configuration ':conf'.
   > Could not find any version that matches org.utils:lib:1.+.

The fact that you're getting a "Could not resolve com.prezi.test.target:boxfish-test-target:1.+" error implies to me that you might be hitting an exception during selection/resolution that is stopping the resolution process in mid-stride (which is why you don't see the later versions).  What's the stack trace when this occurs?  

Gary


On Mon, Sep 1, 2014 at 2:36 PM, Lóránt Pintér <[hidden email]> wrote:
Hi,

I’ve been testing ComponentSelection with 2.2-20140831220010+0000, and it mostly works, except I don’t get all the candidates that I’d expect to get.

I'd like to be able to select a version of a dependency that was built from a specific branch. Following a suggestion from Adam, by using the new ivy-publish plugin, I put some informationin the ivy.xml about the current branch, and the list of other branches that were available during build:

  <info organisation="com.prezi.test.target" module="boxfish-test-target" branch="master" revision="1.0-3-g1761154" status="integration" publication="20140901194902">
    <ns:branches xmlns:ns="http://prezi.com/gradle/boxfish">master,test-branch</ns:branches>
  </info>

I set up a test project, and published a few versions of it from two different branches, trying to simulate how things would work in real life. Here are the versions in the order they were published:
  • 1.0-8-gf0590b3 from test-branch
  • 1.0-3-g1761154 from master
  • 1.0-9-g14ae9b9 from test-branch
  • 1.0-4-g4b991e5 from master
  • 1.0-10-g5ee4b9a from test-branch
I created another project that depends on version "1.+" of my test project. To can track which versions are tried as candidates, I added this to the build:

configuration.getResolutionStrategy().getComponentSelection().all(new RuleAction<ComponentSelection>() {
@Override
public List<Class<?>> getInputTypes() {
return Arrays.<Class<?>> asList(IvyModuleDescriptor.class);
}

@Override
public void execute(ComponentSelection subject, List<?> inputs) {
IvyModuleDescriptor ivyDescriptor = (IvyModuleDescriptor) inputs.get(0);
logger.info("Branch is {}", ivyDescriptor.getBranch());
for (Map.Entry<QName, String> entry : ivyDescriptor.getExtraInfo().asMap().entrySet()) {
logger.info("{} = {}", entry.getKey(), entry.getValue());
}
subject.reject("Because we can");
}
});

After running `gradle build` I expected to see all of the versions of my test project printed, but I only got a few of them:

Cached resource is up-to-date (lastModified: Mon Sep 01 19:54:25 CEST 2014). [HTTP: https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-10-g5ee4b9a/ivy-1.0-10-g5ee4b9a.xml]

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-10-g5ee4b9a' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-9-g14ae9b9' rejected by component selection rule: Because we can

Branch is test-branch

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-8-gf0590b3' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



After this I published 1.0-13-g3b3374a from master, and now only that single version is tried as candidate:

Download https://artifactory.prezi.com/prezi-client/com/prezi/test/target/boxfish-test-target/1.0-13-g3b3374a/ivy-1.0-13-g3b3374a.xml

Resource missing. [HTTP GET: https://artifactory.prezi.com/external-libs/com/prezi/test/target/boxfish-test-target/maven-metadata.xml]

Selected primary task 'build' from project :

Branch is master

{http://prezi.com/gradle/boxfish}branches = master,test-branch

Selection of 'com.prezi.test.target:boxfish-test-target:1.0-13-g3b3374a' rejected by component selection rule: Because we can


FAILURE: Build failed with an exception.


* What went wrong:

Could not resolve all dependencies for configuration ':modules'.

> Could not resolve com.prezi.test.target:boxfish-test-target:1.+.

  Required by:

      com.prezi.test.source:boxfish-test-source:0.0-SNAPSHOT

   > This module has not been resolved.



How does Gradle decide which versions to offer as candidates for a certain dependency?

--

Pinter Lorant
Developer at Prezi