On 04/09/2010, at 2:01 AM, Kenneth Kousen wrote:

> Bingo!  That did it.  If I run the wsgen task directly, it correctly 
> generates both the jaxws package and the WSDL file.  Thanks a million.
> 
> If I want to run this task as part of a normal build, and I need to wait 
> until after compileGroovy is finished to do it, how should I make that 
> happen?  Is this as appropriate processResources step, or should I wait for 
> the "classes" phase?
> 
> I'm thinking along the lines of
> 
> processResources.dependsOn(wsgen)
> 
> or maybe that should be 
> 
> compile.dependsOn(wsgen)
> 
> or even later, like jar.  What's the right way to do this?

I would use 'classes', that is:

classes.dependsOn wsgen

Pretty much everything which uses the contents of the classes dir ends up 
depending on 'classes'. This includes tasks like jar, test and war. But it also 
include things we might add to Gradle in the future, such as integration tests 
or fat jars, or maybe IDE integration will make use of it.

As such, 'classes' is the standard extension point for adding tasks which 
contribute extra stuff to the classes dir.


> 
> Thanks again,
> 
> Ken
> 
> On Fri, Sep 3, 2010 at 12:53 AM, Rene Groeschke <[email protected]> wrote:
>  Hi Kenneth,
> 
> Am 03.09.10 01:16, schrieb Kenneth Kousen:
> > 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')
> >          }
> >      }
> >     }
> > }
> Aaahrgh,
> while watching your wsgen definition again, I think I got the problem.
> The classpath property we add the sourceSet.main.classes is the
> classpath of the task definition and not of the wsgen ant task itself.
> so we mixed up the classpath of your ant task definition and the wsgen
> classpath. try this:
> 
> task wsgen(dependsOn: compileGroovy)  {
> if (!(file('src/mypackage/jaxws')).exists()) {
>     doLast{
>        ant {
>                taskdef(name:'wsgen',
>                        classname:'com.sun.tools.ws.ant.WsGen',
>                        classpath:configurations.jaxws.asPath)
> 
>                wsgen(keep:true,
>                        destdir: 'bin',
>                        sourcedestdir:'src',
>                        resourcedestdir:'resources',
>                        genwsdl:'true',
>                        classpath:sourceSets.main.classes.asPath,
>                        sei:'   mypackage.MySIB')
>         }
>     }
>    }
> }
> 
> 
> you can print the used classpathes easily by:
> 
>    println (configurations.jaxws.asPath) //classpath of the ant task
> definition
> 
>    println (sourceSets.main.classes.asPath) //path to your compiled
> productive code
> 
> 
> regards,
> René
> 
> --
> ------------------------------------
> 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


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to