Hi Ken,
Am 02.09.10 23:01, schrieb Kenneth Kousen:
> Ah, yes. The declared dependency between the compileJava task and the wsgen
> task was a copy and paste error. I was trying to figure out the wsgen task
> based on the way you showed me how to run a wsimport task.
>
> Removing that line means that the wsgen task is not called during the build.
> In order to make it happen, I added
>
> jar.dependsOn(wsgen)
>
> but when the wsgen task ran, it still couldn't find the compiled SIB. :(
>
> Here's my (customized) project layout, in case that's the problem:
>
> sourceSets {
> main {
> java { srcDirs = [] }
> groovy { srcDir 'src' }
> }
> test {
> java { srcDirs = [] }
> groovy { srcDir 'tests' }
> resources { srcDir 'resources' }
> }
> }
This sourceSet configuration doesn't configure a source directory for
the plain java sourceset. This means that compileJava doesn't produce
output to sourceSet.main.classes and if wsgen is executed before
compileGroovy is executed (which produces all classes) the classes
directory is empty and wsgen fails. Instead of depending on
compileJava, wsgen should depend on the "classes" task. can you post your
For further debugging, please run the wsgen task explicitly. Is the
compileGroovy task executed before and is "mypackage.MySIB" created
correctly before wsgen runs?
> I find this layout works really well for Eclipse projects that combine Java
> and Groovy, as mine normally do.
>
> Ken
>
> On Thu, Sep 2, 2010 at 4:43 PM, Rene Groeschke <[email protected]> wrote:
>
>> Hi again,
>> sorry the snippet
>>
>> -- compileJava.dependsOn(wsgen) --
>>
>> confused me, since if the wsgen task depends on output of the
>> compileJava task (compiled classes) you cannot configure the compileJava
>> task to be dependent by wsgen.
>>
>> To add the compileJava output to the classpath of your wsgen task you
>> can write:
>>
>> task wsgen(dependsOn: compileJava) {
>> doLast{
>> ant {
>> taskdef(name:'wsgen',
>> classname:'com.sun.tools.ws.ant.WsGen',
>> classpath:(configurations.jaxws + sourceSet.main.classes).asPath)
>> wsgen(keep:true,
>> destdir: 'bin',
>> sourcedestdir:'src',
>> resourcedestdir:'resources',
>> genwsdl:'true',
>> sei:'mypackage.MySIB')
>> }
>> }
>> }
This wsgen configuration creates source files to the src directory. but
this directory already contains your SIB code. To avoid problems and
confusions here, the sourcedestdir property should be removed or point
to a different directory.
Furthermore if you want your wsgen generated code in the jar created by
the jar task of gradle, you either have to add the bin directory to your
jar configuration, or change the destdir property in your wsgen task to
sourceSets.main.classesDir.absolutePath. this creates the classes
generated by wsgen at the same place the other compile tasks
(compileGroovy in your example) are storing the compiled classes.
------------------------------------
Rene Groeschke
[email protected]
http://www.breskeby.com
http://twitter.com/breskeby
------------------------------------
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email