[GRADLE-1857] source(someDir) is not adding the directory to the set of sources, instead is clobbering it Created: 20/Oct/11  Updated: 04/Jan/13  Resolved: 23/Feb/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: 1.0-milestone-9

Type: Bug
Reporter: David Kowis Assignee: Unassigned
Resolution: Fixed Votes: 0


 Description   

Using the java and groovy plugin in combination with generating sources using the wsimport ant task:
<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>

Instead of the source directory being appended to the source for the given compile task, it is clobbering it, such that only the sources for the wsimport generated sources are being compiled.

Workaround: use += and create a FileTree object out of the directory name.
<paste>
compileJava

{ dependsOn wsimport source += fileTree(dir: wsimport.generatedDir) }

compileTestJava

{ dependsOn wsimport source += fileTree(dir: wsimport.generatedDir) }

compileTestGroovy

{ dependsOn wsimport source += fileTree(dir: wsimport.generatedDir) }

</paste>


Generated at Wed Jun 30 12:06:14 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.