On 02/09/2010, at 6:23 AM, Zsolt Kúti wrote: > On Tue, 31 Aug 2010 08:24:20 +1000 > Adam Murdoch <[email protected]> wrote: > >> On 30/08/10 11:28 PM, tinca wrote: >>> Hello, >>> >>> A custom task that uses ant task works fine with 0.9-preview-3. In >>> rc-1 it fails: >>> >>> Execution failed for task ':serviceJar'. >>> Cause: taskdef class org.jini.rio.tools.ant.ClassDepAndJarTask >>> cannot be found >>> >>> lib dependency defines: >>> compile module('rioproject:rio:4.0') { >>> dependency(':rio:4.0') { >>> artifact { name = 'classdepandjar'; type = 'jar' } >>> .... >>> >>> Its usage is: >>> task serviceJar<< { >>> ant.taskdef( >>> name: "classdepandjar", >>> classname: "org.jini.rio.tools.ant.ClassDepAndJarTask", >>> classpath: configurations.compile.asPath + ':' + >>> compileJava.destinationDir+ ':' + compileTestJava.destinationDir) >>> ant.classdepandjar( >>> ... >>> >>> Release info mentions nothing on this: >>> http://gradle.1045684.n5.nabble.com/ANN-Gradle-0-9-rc-1-released-td2263741.html >>> >>> If the lib containing ClassDepAndJarTask is put under testRuntime >>> an other error appears, that reports missing classes which >>> otherwise present in compileJava.destinationDir. >>> >>> Any idea how to solve this? >> >> You might start by confirming that the expected library jars are in >> the classpath you specify for the taskdef. Perhaps you could print >> out configurations.compile.asPath just before the taskdef. > > Yes, I can confirm that he jar is missing from the classpath. (Even > without explicit printing it can be seen as gradle is kind enough to do > so in such a case.) > > Since testCompile and testRuntime contains module dependency > overlapping with that of compile I temoprarily commented out them which > made the missing dependency appear. > > So definitions below works with preview-3, but not with rc1: > > compile module('rioproject:rio:4.0') { > dependency(':rio:4.0') { > artifact { name = 'boot'; type = 'jar' } > artifact { name = 'cybernode'; type = 'jar' } > artifact { name = 'classdepandjar'; type = 'jar' } > artifact { name = 'groovy-all'; type = 'jar' } > } > ... > testCompile module('rioproject:rio:4.0') { > dependency(':rio:4.0') { > artifact { name = 'rio-test'; type = 'jar' } > artifact { name = 'resolver'; type = 'jar' } > } > } > > I like the former separation and don't see how I can do it with rc1.
It looks like declaring the same module more than once, like you do above, is broken. It was never very well defined, and so it a bit of a coincidence that what you tried actually worked. I've added a JIRA issue for this: http://jira.codehaus.org/browse/GRADLE-1143 You could probably achieve what you need by simply getting rid of the modules altogether: compile(':rio:4.0') { artifact { ... } } testCompile(':rio:4.0') { artifact { ... } } -- Adam Murdoch Gradle Developer http://www.gradle.org CTO, Gradle Inc. - Gradle Training, Support, Consulting http://www.gradle.biz
