I'm using a JAX-WS client for my Spring-WS app. I modeled my use of Jax-WS on the 'airilne' sample's jaxws client and, therefore, run the 'wsimport' generation of client sources from a standalone Ant build file.
I'd like to migrate that 'wsimport' Ant task into my pom.xml file so that I can 'generate-sources', client artifacts and unit tests from the same place.
However, when I migrate the "Mavenified" build.xml file over to plain old Ant 'generate-client-sources.xml' build file, I cannot seem to get addressability to any of the built-in Maven classpath variables. I get several variations on the "Reference maven.plugin.classpath not found." error message depending on whether I'm trying to use the 'maven.compile.classpath', 'maven.plugin.classpath', 'maven.test.classpath',... (with corresponding changes to the <dependencies> of course!)
Here is an example of my attempt to get the plugin's variation working.
Here is the Ant file I'm trying to run under Maven 2.0.5:
using the 'maven.plugin.classpath' as described on the maven-antrun-plugin webpage, and modify the pom.xml file accordingly:Code:<?xml version="1.0"?> <project name="jaxws-client-targets" default="generate-client-sources"> <property name="target.dir" value="target"/> <target name="init" description="Set up environ for 'wsimport' generate-sources."> <mkdir dir="${target.dir}/classes"/> <mkdir dir="${target.dir}/generated-sources/main/java"/> </target> <target name="generate-client-sources" depends="clean,init"> <taskdef name="wsimport" classname="com.sun.tools.ws.ant.WsImport" classpathref="maven.plugin.classpath"/> <wsimport wsdl="${basedir}/src/main/webapp/testapp.wsdl" destdir="${target.dir}/classes" package="com.testapp.ws.client" verbose="true" keep="true" sourceDestDir="${target.dir}/generated-sources/main/java"/> </target> <target name="clean"> <delete dir="${target.dir}/classes/com/testapp/ws/client"/> <delete dir="${target.dir}/generated-sources/main/java/com/testapp/ws/client"/> </target> </project>
Note that I've migrated the artifacts from the original Ant file's:Code:<build> ... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <configuration> <tasks> <ant antfile="${basedir}/generate-client-sources.xml" inheritRefs="true"> <target name="generate-client-sources"/> </ant> </tasks> <sourceRoot>${project.build.directory}/generated-sources/main/java</sourceRoot> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-tools</artifactId> <version>EA3</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-xjc</artifactId> <version>2.1-EA2</version> </dependency> <dependency> <groupId>com.sun.xml.stream.buffer</groupId> <artifactId>streambuffer</artifactId> <version>0.3</version> </dependency> <dependency> <groupId>com.sun.xml.stream<groupId> <artifactId>sjsxp</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.jvnet.staxex</groupId> <artifactId>stax-ex</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>com.sun.xml.messaging.saaj</groupId> <artifactId>saaj-impl</artifactId> <version>1.3</version> </dependency> </dependencies> </plugin> </plugins> </build>
to 'dependencies' under the <plugin>.Code:<artifact:dependencies pathId="generate.classpath">
When I run this, I get that 'maven.plugin.classpath' is not found:
and when I try the bug workaround (reassign the 'maven.plugin.classpath' variable to an Ant file property), I get the same problem.Code:[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-antrun-plugin:1.1:run' --> [DEBUG] (f) artifacts = [ant:ant:jar:1.6.5:runtime,ant:ant-launcher:jar:1.6.5:runtime,org.apache.maven:maven-project:jar:2.0.1:runti [DEBUG] (f) project = org.apache.maven.project.MavenProject@a8612a94 [DEBUG] (f) sourceRoot = /home/corbag/svn/testapp/webservices/target/generated-sources/main/java [DEBUG] (f) tasks = [DEBUG] -- end configuration -- [INFO] [antrun:run {execution: generate-client-sources}] [INFO] Executing tasks [DEBUG] getProperty(ns=null, name=ant.reuse.loader, user=false) [DEBUG] getProperty(ns=null, name=ant.executor.class, user=false) [DEBUG] getProperty(ns=null, name=ant.file, user=false) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error executing ant tasks Embedded error: The following error occurred while executing this line: /home/corbag/svn/testapp/webservices/generate-client-sources.xml:5: Reference maven.plugin.classpath not found. [INFO] ----------------------------------------------------------------------- [DEBUG] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Error executing ant tasks
Has anyone been successful in getting the 'wsimport' Ant task to work under Maven? If so, can you post some working snippets? TIA.


Reply With Quote
Maybe I'm confused as to the versions being used. I thought you said that JAXB1 wasn't supported by any known Maven plugin:
. I'm working on a new version of the airline sample, though, using JAXB2 instead of JAXB1, JPA instead of Hibernate, and also use the new Spring-WS annotations.

