RC1 - IVY - org.gradle.api.artifacts.ResolveException when using dynamic revisions (version)

I am using Gradle ( RC1) with Ivy and have the problem that whenever I use a dynamic version number like e.g 1.8.+ the artifact can’t be resolved.

this works :

[group: 'commons-beanutils' , name: 'commons-beanutils', version: '1.8.3']

while this :

[group: 'commons-beanutils' , name: 'commons-beanutils', version: '1.8.+']

results in : Could not find any version that matches group:commons-beanutils, module:commons-beanutils, version:1.8.+

According to jira GRADLE-1789 this should work correct since milestone-5 so I wonder what the problem may be in my case. Any suggestions ?

Hello Nelson, I can’t reproduce this problem. Can you provide a self-contained build.gradle snippet, that demonstrates your problem?

Hi Rene ,

here a extract from my build.gradle file.

repositories {
    ivy {
        credentials {
            username = project.local.getProperty('ivyrepo.user')
            password = project.local.getProperty('ivyrepo.password')
        }
                      ivyPattern "https://COMPANY/repository/trunk/ivyrepo/[organisation]/[module]/[revision]/[module]-ivy.xml"
        artifactPattern "https:/COMPANY/repository/trunk/ivyrepo/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"
              }
}
    dependencies {
    compile fileTree(dir: 'lib/jar', include: '*.jar')
    compile fileTree(dir: 'build/WEB-INF/lib', include: '*.dll')
    testCompile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.8.+'
   }

Now when I run the testCompile task and have the version set to ‘1.8.3’ it all works. When I use ‘1.8.+’ instead the build fails with the following message:

Could not find any version that matches group:commons-beanutils, module:commons-beanutils, version:1.8.+. Required by:

:RuA:1.0 Could not execute build using Gradle distribution 'file:/C:/Entwicklung/Tools/Gradle/gradle-1.0-rc-1-all.zip

Stacktrace :

org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration :testCompile’. … Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundException: Could not find any version that matches group:commons-beanutils, module:commons-beanutils, version:1.8.+. Required by:

:RuA:1.0 org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$DynamicVersionResolveResult.notFound(LazyDependencyToModuleResolver.java:184)

Hello Nelson,

Does “gradle clean build --refresh-dependencies” solves your problem? If not, can you post the output of “gradle build -i --refresh-dependencies” here? The output should contain something like this:

Resource missing. [HTTP GET: https://COMPANY/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-ivy.xml]
Resource missing. [HTTP GET:https://COMPANY/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/1.8.2/commons-beanutils-ivy.xml]
Resource missing. [HTTP GET: https://COMPANY/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/1.8.1/commons-beanutils-ivy.xml]
Resource missing. [HTTP GET: https://COMPANY/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-ivy.xml]
Resource missing. [HTTP GET: https://COMPANY/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/1.8.0-BETA/commons-beanutils-ivy.xml]

How is your ivy repo created, manually or do you use a repository manager? seems like you deploy your ivy modules to a svn repo?

Hi Rene,

Our Ivy repo is created manually. Yes its right we deploy the artifacts we use to svn and use this “private” repository for dependency management.

Unfortunately I was not able to figure out what causes my problem with dynamic revision. I tried you suggestions but the issue remains the same.

To minimize all side effects I updated to the latest RC3 version and tried out to resolve against

‘mavenCentral’ with dynamic revisions and it works great.

The expected output in the sense of “Resource missing…”

I was not able to find when I run the tasks with --debug --stacktrace etc.

It seams to me that when using dynamic revisions the credentials are not used correctly. Like I said this happens only with dynamic revisions and Ivy repository

Here the log output:

17:39:18.381 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] try to get credentials for: Subversion Repository@company.de 17:39:18.381 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] authentication: k=‘Subversion Repository@company.de’ c=‘null’ 17:39:18.381 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] HTTP response status: 401 url=https://company.de/repository/trunk/ivyrepo/commons-beanutils/commons-beanutils/ 17:39:18.381 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.IvyLoggingAdaper] CLIENT ERROR: Authorization Required