On 10/20/2011 11:19 AM, David Kowis wrote:
> I've got a project that I'm trying to convert from maven to gradle, and
> for the most part it's going well. I'm generating sources using
> wsimport's ant task, and adding them to the various groovy and java
> compile targets:
> <paste>
> task wsimport(dependsOn: processResources) {
> generatedDir = "src/generated/java"
> new File(generatedDir).mkdirs()
>
> doLast {
> ant.taskdef(name:'wsimport',
> classname:'com.sun.tools.ws.ant.WsImport',
> classpath:configurations.jaxws.asPath)
> ant.wsimport( keep:true,
> target: "2.1",
> sourceDestDir: "$generatedDir",
> package: "com.imasample.somesoapservice",
> wsdl: "$projectDir/src/main/wsdl/tehWSDL.wsdl"
> )
> }
> }
>
> compileJava {
> dependsOn wsimport
> source wsimport.generatedDir
> }
> compileTestJava {
> dependsOn wsimport
> source wsimport.generatedDir
> }
> compileTestGroovy {
> dependsOn wsimport
> source wsimport.generatedDir
> }
> </paste>
> All right, I've figured out what's causing the problem, but I'm not sure how to solve it, as the examples I've found on the internet tell me to do the thing that's obviously not working right. The only thing in the build/classes/test/ directory are the ones generated from wsimport. that would lead me to believe that the sourcetree is being set to *only* include the wsimport.generatedDir, not appending it as I thought. Looking at the API docs for FileTree, I came up with the idea that I should do source += wsimport.generatedDir however that nets me this: Cause: No signature of method: org.gradle.api.internal.file.CompositeFileTree$FilteredFileTree.plus() is applicable for argument types: (java.lang.String) values: [src/generated/java] Possible solutions: plus(org.gradle.api.file.FileCollection), plus(org.gradle.api.file.FileTree), minus(org.gradle.api.file.FileCollection), split(groovy.lang.Closure), is(java.lang.Object), use([Ljava.lang.Object;) So what's the proper way to add an additional source dir to my various compile tasks? I have a src/generated-sources/java that needs to be included when building the java and groovy stuff. Thanks, David
signature.asc
Description: OpenPGP digital signature
