On 11/08/10 2:27 PM, Glen Stampoultzis wrote:
I asked a question on stackoverflow on how to use custom configurations [1] to switch I got a good answer from Hans however I still have some problems which may or may not be related.Rather than the normal "compile", "runtime" configurations the configurations I use (for historical reasons) are main, test etc... Unfortunately when I try and customize the classpath to use this configurations instead I'm running into problems. My build (shown below) has a customization to the sourceSets to achieve this. Unfortunately when I run it I get an error. Anyone able to share what I'm doing wrong? ========================================== $ gradle compileJava FAILURE: Build failed with an exception. * What went wrong: Circular dependency between tasks. Cycle includes [task ':classes', task ':compileJava']. * Try: Run with -s or -d option to get more details. Run with -S option to get the full (very verbose) stacktrace. BUILD FAILED Total time: 5.917 secs ========================================== ========================================== defaultTasks 'compileJava' repositories { ... unimportant details chopped ... } apply plugin: 'java' configurations { testx /* Using test as a configuration name does not seem to work */ main web lock dao conf tools } dependencies { main group: "apache", name: "log4j", version: "1.2.15", configurations: ["default"] main group: "google", name: "guice", version: "2.0", configurations: ["default","servlet","spring"] main group: "jcip", name: "jcip-annotations", version: "1.0", configurations: ["default"] ... unimportant details chopped ... } sourceSets { main { java { srcDir 'gen/java' srcDir 'src/java' } resources { srcDir 'src/resources' } compileClasspath = sourceSets.main.classes + configurations.main
Above, you're asking that the compiled classes of the main source set be added to the compile classpath of the main source set, ie add the classes to the classpath to use to compile those classes. This is causing the cycle.
You might want instead something like: compileClasspath = configurations.main runtimeClasspath = classes + compileClasspath -- Adam Murdoch Gradle Developer http://www.gradle.org CTO, Gradle Inc. - Gradle Training, Support, Consulting http://www.gradle.biz --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
