Dependency resolution error: cyclic variable definitions

I have a dependency on org.apache.geronimo.framework:geronimo-kernel:2.1.7 unfortunately there is a variable in the pom file of $version which is used for the artifact version. This is causing a cyclic variable definition when I try to run my build script.

Is there a way to work around this? Or do I have to edit these pom files and place in a local repository?

Thanks

apply plugin: 'java'
  repositories {
 mavenCentral()
}
dependencies {
 compile ("org.apache.geronimo.framework:geronimo-kernel:2.1.7@jar") {
  provided : true
 }
}
  Starting Build  Settings evaluated using empty settings file.  Projects loaded. Root project using build file 'C:\Users\SmithJ\Desktop\build.gradle'.  Included projects: [root project 'Desktop']  Evaluating root project 'Desktop' using build file 'C:\Users\SmithJ\Desktop\build.gradle'.  All projects evaluated.  Selected primary task 'build'  Tasks to be executed: [task ':compileJava', task ':processResources', task ':classes', task ':jar', task ':assemble', task ':compileTestJava', task ':processTestResources', task ':testClasses', task ':test', task ':check', task ':  build']  :compileJava  Skipping task ':compileJava' as it has no source files.  :compileJava UP-TO-DATE  :processResources  Skipping task ':processResources' as it has no source files.  :processResources UP-TO-DATE  :classes  Skipping task ':classes' as it has no actions.  :classes UP-TO-DATE  :jar  Skipping task ':jar' as it is up-to-date.  Skipping task ':jar' as it is up-to-date  :jar UP-TO-DATE  :assemble  Skipping task ':assemble' as it has no actions.  :assemble UP-TO-DATE  :compileTestJava  Skipping task ':compileTestJava' as it has no source files.  :compileTestJava UP-TO-DATE  :processTestResources  Skipping task ':processTestResources' as it has no source files.  :processTestResources UP-TO-DATE  :testClasses  Skipping task ':testClasses' as it has no actions.  :testClasses UP-TO-DATE  :test  file or directory 'C:\Users\SmithJ\Desktop\build\classes\test', not found  Checksum SHA-1 matched cached resource: [HTTP GET: http://repo1.maven.org/maven2/org/apache/geronimo/framework/geronimo-kernel/2.1.7/geronimo-kernel-2.1.7.pom.sha1]  Checksum SHA-1 matched cached resource: [HTTP GET: http://repo1.maven.org/maven2/org/apache/geronimo/framework/modules/2.1.7/modules-2.1.7.pom.sha1]  Checksum SHA-1 matched cached resource: [HTTP GET: http://repo1.maven.org/maven2/org/apache/geronimo/framework/framework/2.1.7/framework-2.1.7.pom.sha1]

 FAILURE: Build failed with an exception.

 * What went wrong:  Could not resolve all dependencies for configuration ':testRuntime'.  > Could not resolve group:org.apache.geronimo.framework, module:geronimo-kernel, version:2.1.7.

 Required by:



  :Desktop:unspecified

  > Could not resolve group:org.apache.geronimo.framework, module:modules, version:2.1.7.



  > Could not resolve group:org.apache.geronimo.framework, module:framework, version:2.1.7.





  > cyclic variable definition: cycle = [version, version]

 * Try:  Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

 BUILD FAILED

 Total time: 3.438 secs  

Pom File: http://repo1.maven.org/maven2/org/apache/geronimo/framework/geronimo-kernel/2.1.7/geronimo-kernel-2.1.7.pom

If you use ‘@jar’, the POM should be irrelevant. Otherwise I’d consider this a Gradle bug.

PS: ‘provided : true’ is not a supported feature/syntax. It’s a no-op.

If you use @jar, the POM should be irrelevant

For better or worse, this is not true, and hasn’t been since 0.9 at least: GRADLE-1194.

Thanks for reporting: I’ve added GRADLE-2148 to track this.

I did the same test with Ivy last night and it also can’t resolve the dependency. So it’s probably not a Gradle bug.

To get around this I suppose I have two options:

  1. Store the dependencies in a local repository with edited pom’s. 2. Try and fix the Ivy code.

If there is any other options I’d be happy to hear about them.

Thanks

If you’re planning to fix the ivy code, you’ll want to check out ‘org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser’, which is our forked copy of the ivy code.

But storing the dependencies in a local repository is probably simpler :).