<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>com.xyz.abc.app</groupId> <artifactId>serviceapp-ant</artifactId> <version>1.0</version> <packaging>jar</packaging> <name>serviceapp webservice client</name> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.6</version> <dependencies> <dependency> <groupId>com.sun</groupId> <artifactId>tools</artifactId> <version>1.6.0_14</version> <scope>system</scope> <systemPath>${java.home}/../lib/tools.jar</systemPath> </dependency> <dependency> <groupId>org.apache.xmlbeans</groupId> <artifactId>xmlbeans</artifactId> <version>2.4.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.logging</groupId> <artifactId>com.bea.core.logging</artifactId> <version>1.6.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.utils.classloaders</groupId> <artifactId>com.bea.core.utils.classloaders</artifactId> <version>1.6.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.annogen</groupId> <artifactId>com.bea.core.annogen</artifactId> <version>1.3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.utils.full</groupId> <artifactId>com.bea.core.utils.full</artifactId> <version>1.7.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.xml.beaxmlbeans</groupId> <artifactId>com.bea.core.xml.beaxmlbeans</artifactId> <version>1.1.0.0_2-4-1</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.weblogic.stax</groupId> <artifactId>com.bea.core.weblogic.stax</artifactId> <version>1.6.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.xml.staxb.runtime</groupId> <artifactId>com.bea.core.xml.staxb.runtime</artifactId> <version>1.5.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.xml.staxb.buildtime</groupId> <artifactId>com.bea.core.xml.staxb.buildtime</artifactId> <version>1.4.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-rt</artifactId> <version>2.1.4</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor</groupId> <artifactId>com.bea.core.descriptor</artifactId> <version>1.7.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor.j2ee.binding</groupId> <artifactId>com.bea.core.descriptor.j2ee.binding</artifactId> <version>1.3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor.j2ee</groupId> <artifactId>com.bea.core.descriptor.j2ee</artifactId> <version>1.3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor.wl</groupId> <artifactId>com.bea.core.descriptor.wl</artifactId> <version>1.3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor.wl.binding</groupId> <artifactId>com.bea.core.descriptor.wl.binding</artifactId> <version>1.3.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.descriptor.settable.binding</groupId> <artifactId>com.bea.core.descriptor.settable.binding</artifactId> <version>1.6.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.weblogic.saaj</groupId> <artifactId>com.bea.core.weblogic.saaj</artifactId> <version>1.4.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.weblogic.workmanager</groupId> <artifactId>com.bea.core.weblogic.workmanager</artifactId> <version>1.7.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.management.core</groupId> <artifactId>com.bea.core.management.core</artifactId> <version>2.5.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.bea.core.i18n</groupId> <artifactId>com.bea.core.i18n</artifactId> <version>1.6.0.0</version> <scope>provided</scope> </dependency> <!-- JEE dependencies --> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc-api</artifactId> <version>1.2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>weblogic</groupId> <artifactId>webserviceclient</artifactId> <version>10.3.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>weblogic</groupId> <artifactId>wlfullclient</artifactId> <version>10.3</version> <scope>provided</scope> </dependency> </dependencies> <executions> <execution> <phase>generate-sources</phase> <configuration> <target> <!-- <property name="cp5" refid="maven.compile.classpath"/> <property name="cp6" refid="maven.plugin.classpath"/> <echo message="maven plugin classpath is ${maven.plugin.classpath}" /> <echo message="java ext dirs is ${java.ext.dirs}"/> <echo message="cp6 is ${cp6}"/> --> <property name="generated.source.dir" value="target/generated-sources/wlclientgen"/> <taskdef name="clientgen" classname="weblogic.wsee.tools.anttasks.ClientGenTask" classpathref="maven.compile.classpath" /> <!-- use dynamic wsdl url <clientgen wsdl="http://localhost:7001/serviceappv2_ws/serviceapp?wsdl" destDir="target/generated-sources/wlclientgen" packageName="com.xyz.abc.app.ws.service.delegate.serviceapp.stub.jaxrpc" type="JAXRPC" /> --> <clientgen wsdl="serviceapp.wsdl" destDir="${generated.source.dir}" packageName="com.xyz.abc.app.ws.service.delegate.serviceapp.stub.jaxrpc" type="JAXRPC" /> <echo message="Make directory target/classes."/> <mkdir dir="${basedir}/target/classes"/> <echo message="Calling javac." /> <javac srcdir="${generated.source.dir}" destdir="${basedir}/target/classes" classpathref="maven.plugin.classpath" includes="com/xyz/abc/app/ws/service/delegate/serviceapp/stub/jaxrpc/*.java" /> <echo message="Copy xml and wsdl files from generated source to class path folder" /> <copy todir="${basedir}/target/classes/com/xyz/abc/app/ws/service/delegate/serviceapp/stub/jaxrpc"> <fileset dir="${generated.source.dir}/com/xyz/abc/app/ws/service/delegate/serviceapp/stub/jaxrpc"> <include name="**/*.xml" /> <include name="**/*.wsdl" /> </fileset> </copy> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>javax.xml</groupId> <artifactId>jaxrpc-api</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>weblogic</groupId> <artifactId>webserviceclient</artifactId> <version>10.3.2.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>weblogic</groupId> <artifactId>wlfullclient</artifactId> <version>10.3</version> </dependency> </dependencies> </project>
Notes:
- This pom uses a jar jaxws-rt-2.1.4.jar. There are two implementations for this jar. One is from Sun. And the other is from Glassfish. The Glassfish implementation should be used. If you use the Sun's version, you will get a build exception "An Ant BuildException has occured: java.lang.NoSuchMethodError: getEncodedURL".
- For the wsdl file, you can point to an active URL. You can also point to an actual wsdl file copy in your local machine.
- In the above example, the execution is associated to the maven life cycle "generate-sources" phase. The target also creates some folder and copies the xml and wsdl files to a directory so they are on the classpath in the packaged artifact.