Thanks for the reply. That's very helpful.
I see now how to tie into the basic process, but I still have a question. I
hadn't realized there was a wsimport ant task. I tried to configure it this
way:
task wsimport(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {
doLast{
ant.taskdef(name:'wsimport',
classname:'com.sun.tools.ws.ant.WsImport')
ant.wsimport(keep:true,
destdir: sourceSets.main.classesDir,
sourcedestdir: sourceSets.main.java.srcDirs,
wsdl:'...url of wsdl file...')
}
}
compileJava.dependsOn(wsimport)
But the result I get is:
"taskdef class com.sun.tools.ws.ant.WsImport cannot be found
using the classloader AntClassLoader[]"
I was going to start playing with dependencies for JAX-WS, but wsimport is
already part of JDK 1.6. How do I tell Gradle where to find it?
I suppose I could fall back to just doing an exec task, but if this is the
right way to do it I'd like to get it to work.
Ken
On Sat, Aug 28, 2010 at 10:08 PM, Rene Groeschke <[email protected]>wrote:
> Hi Kenneth,
>
> I think the easiest way to run wsimport during your build is to create a
> gradle task based on the wsimport ant task. If you declare the task like
> this:
> ---------
> task wsimport(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {
> doLast{
> //define your ant task and execute it.
> }
> }
> compileJava.dependsOn(wsimport)
> ---------
> the task should be executed just before your compileJava task is executed.
> You can use gradles great (but unfurtunately not yet proper documented)
> "incremental build" feature to check during your build if the task must be
> executed or not. To use this feature you have to define output and input
> parameters of your task:
>
> ---------
> task wsimport(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {
> outputs.files //your destdir / your srcdestdir
> inputs.files //your wsdl file
> doLast{
> //define your ant task and execute it.
> }
> }
> compileJava.dependsOn(wsimport)
> ---------
>
> Now the task wsimport is only executed if the output wasn't created before
> or the wsdl file has changed.
>
> regards,
> René
>
>
>
>
> Am 29.08.10 01:10, schrieb Kenneth Kousen:
>
> I think this is easy, I'm not sure. I'm building a Java/Groovy project
> that's based on a SOAP-based web service. I normally generate the client
> stubs using the "wsimport" command from the command line ahead of time, but
> I'd like to make that part of the overall build process if the stubs don't
> already exist.
>
> I'd like to define a task that checks to see if the stubs are already
> there (I know what the package is, so I can check whether it exists or not),
> and, if not, runs wsimport before the compile task. How do I do that?
>
> Ken
> --
> Kenneth A. Kousen
> President
> Kousen IT, Inc.
>
> Email: [email protected]
> Site: http://www.kousenit.com
> Blog: http://kousenit.wordpress.com
> Twitter: @kenkousen
>
>
>
> --
> ------------------------------------
> Rene Groeschke
> [email protected]http://www.breskeby.comhttp://twitter.com/breskeby
> ------------------------------------
>
>
--
Kenneth A. Kousen
President
Kousen IT, Inc.
Email: [email protected]
Site: http://www.kousenit.com
Blog: http://kousenit.wordpress.com
Twitter: @kenkousen