That one worked. Thanks! I kept trying different alternatives but hadn't used that one yet.
I think most of my gradle problems are really maven problems. Thanks again, Ken On Sun, Aug 29, 2010 at 8:55 AM, Rene Groeschke <[email protected]> wrote: > Hi, > > Am 29.08.10 05:55, schrieb Kenneth Kousen: > > Thanks again. I'm much closer now. > > On Sat, Aug 28, 2010 at 11:37 PM, Rene Groeschke <[email protected]>wrote: > >> Hi Ken, >> >> Am 29.08.10 05:22, schrieb Kenneth Kousen: >> >> 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: >> >> You can get further informations about the ant task at >> https://jax-ws.dev.java.net/nonav/2.1.1/docs/wsimportant.html >> > > I've been looking at that page. How did you realize that the jaxws-tools > version was 2.1EA1? > > I' not sure about the version and just picked one from the mvn repo > > > > >> >> 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? >> >> In the article mentioned above there is a special chapter about running >> wsimport using jdk1.6. I'm not sure if the ant task is part of the jdk. >> > > The link about running on jdk1.6 just says to copy the jaxws-api.jar and > jaxb-api.jar files to the jre/lib/endorsed dir. Since wsimport is already > part of JDK 1.6, that didn't seem very helpful. > > >> but you can add the jaxb-tools jar to your classpath by the following: >> >> -------------- >> ... >> ... >> repositories { >> mavenCentral() //add central maven repo to your buildfile >> } >> >> configurations{ >> jaxws //add a specific configuration, used to run your specific >> wsimport ant task >> } >> >> dependencies{ >> jaxws "com.sun.xml.ws:jaxws-tools:2.1EA1" //add jaxws-tools >> (version 2.1EA1) to the jaxws configuration >> >> } >> >> task wsimport(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME) { >> doLast{ >> //define your ant task by referring to the jaxws configuration >> ant.taskdef(name:'wsimport', >> classname:'com.sun.tools.ws.ant.WsImport', >> classpath:configurations.jaxws.asPath) >> } >> ... >> } >> .... >> -------------- >> > > That was very useful. When I ran that, I wound up downloading a series > of poms and jars. Apparently not everything, though, because now I get: > > java.lang.NoClassDefFoundError: com/sun/xml/txw2/output/XmlSerializer > > I don't know what triggered what additional dependency that requires. > > Maybe the choice of the jaxb version in my example wasn't that lucky. could > you retry it with > > dependencies{ > jaxws "com.sun.xml.ws:jaxws-tools:2.1.4" //add jaxws-tools (version > 2.1EA1) to the jaxws configuration > } > > that's loads the according jaxb-impl.jar which contains the missing class. > > > > René > > -- > ------------------------------------ > 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
