Hi again Rene,
The situation isn't nearly as dire as that sounds.
1. My wsgen task does have "dependsOn: compileGroovy" in it. I can also
confirm that the compileGroovy task runs successfully. I can see the
compiled form of the SEI and SIB inside the 'bin' directory.
2. The wsgen task itself is not trying to overwrite anything. It's only
supposed to generate proxies, which it places in a package called
"mypackage.jaxws", as well as the wsdl file, which it puts in the
'resources' directory. If I run that command from the command line, it
works like a charm.
3. I used the jar task for the dependsOn only because it was the next task
in the build process. I really don't care about the jar task. I just want
to make sure I run wsgen any time after compileGroovy has completed.
4. When I run "gradle clean wsgen" explicitly, the compileJava task runs,
which does nothing, followed by the compileGroovy task, which fills the
build\classes\main\mypackage directory with the compiled SIB and SEI.
Even with all that, though, the wsgen task fails because it can't find the
compiled SIB.
Is there any way I can get the wsgen task to print out what it thinks the
classpath is when it's trying to run?
Again, I really appreciate all the assistance. I'm very enthusiastic about
gradle and want to show others how much it has helped me already, and if I
can get this resolved I'll be that much closer to having a complete story.
For the record, here's my complete build.groovy file at the moment:
apply plugin:'groovy'
apply plugin:'eclipse'
repositories {
mavenCentral()
mavenRepo urls:["http://download.java.net/maven/1",
"http://download.java.net/maven/2"]
}
configurations {
jaxws
}
sourceSets {
main {
java { srcDirs = [] }
groovy { srcDir 'src' }
}
test {
java { srcDirs = [] }
groovy { srcDir 'tests' }
resources { srcDir 'resources' }
}
}
task wsgen(dependsOn: compileGroovy) {
if (!(new File('src/mypackage/jaxws')).exists()) {
doLast{
ant {
taskdef(name:'wsgen',
classname:'com.sun.tools.ws.ant.WsGen',
classpath:(configurations.jaxws + sourceSets.main.classes).asPath)
wsgen(keep:true,
destdir: 'bin',
sourcedestdir:'src',
resourcedestdir:'resources',
genwsdl:'true',
sei:'mypackage.MySIB')
}
}
}
}
jar.dependsOn(wsgen)
def spockVersion = '0.4-groovy-1.7'
dependencies {
groovy group:'org.codehaus.groovy', name:'groovy-all', version:'1.7.4'
jaxws 'com.sun.xml.ws:jaxws-tools:2.1.4'
testCompile 'junit:junit:4.8.1'
testCompile "org.spockframework:spock-core:$spockVersion"
}
Ken
On Thu, Sep 2, 2010 at 5:34 PM, Rene Groeschke <[email protected]> wrote:
> 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
>
>
>
--
Kenneth A. Kousen
President
Kousen IT, Inc.
Email: [email protected]
Site: http://www.kousenit.com
Blog: http://kousenit.wordpress.com
Twitter: @kenkousen