On 21/10/2011, at 6:02 AM, David Kowis wrote:
> On 10/20/2011 01:56 PM, Peter Niederwieser wrote:
>>
>> David Kowis wrote:
>>>
>>> I assume that I don't need to change anything from the default
>>> configuration thanks to applying the 'java' and 'groovy' plugins. The
>>> tests and such should just be available?
>>>
>>
>> Yes, it should just work. Do you have any class files under
>> build/classes/test? If yes, do they seem to match the include pattern you
>> specified for the test task?
>
> I did not have any class files other than the ones listed in my other mail.
>
> In order to get it to not substitute the source path, I had to do this:
>
> compileJava {
> dependsOn wsimport
> source += fileTree(dir: wsimport.generatedDir)
> }
> compileTestJava {
> dependsOn wsimport
> source += fileTree(dir: wsimport.generatedDir)
> }
> compileTestGroovy {
> dependsOn wsimport
> source += fileTree(dir: wsimport.generatedDir)
> }
>
> I had to create a FileTree object out of that property and append it to
> the source for those tasks. Then it started behaving as I expected.
>
> Is there a better way to add source trees?
You might be better off simply adding the source directory to the main source
set:
sourceSets.main.java.srcDir wsimport.generatedDir
compileJava.dependsOn wsimport
The other tasks should just pick this up.
--
Adam Murdoch
Gradle Co-founder
http://www.gradle.org
VP of Engineering, Gradleware Inc. - Gradle Training, Support, Consulting
http://www.gradleware.com