Eric,

I don't think this is exactly the answer to your question, but maybe it
could be useful. Below are some snippets from our maven.xml files for the
server and client pieces of a JWSDP JAX-RPC based application. We put all of
the JWSDP JAR files in our local Maven repository and then reference them as
normal dependencies. Our JWSDP JAXRPC-SI specific configuration files are
called config-[web service model name].xml and are referenced as part of our
source resources in project.xml.

Server side:

  <!--
    This goal creates the JAX-RPC model and WSDL files and places them in
the expanded
    build webapp directory. It runs after the war:webapp goal from the Maven
war plugin.
  -->
  <postGoal name="war:webapp">
  
    <!-- define JAX-RPC ant task -->
    <ant:taskdef name="wscompile"
classname="com.sun.xml.rpc.tools.ant.Wscompile">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
      </ant:classpath>
    </ant:taskdef>
    
    <!-- loop through the resources in project.xml -->
    <ant:echo message="resources=${pom.build.resources}"/>
    <j:forEach var="resource" items="${pom.build.resources}">
      <j:set var="directory" value="${resource.directory}"/>
      <ant:echo message="directory=${directory}"/>
      
      <!-- put XML files from the resource in the 'files' variable -->
      <ant:fileScanner var="files">
        <ant:fileset dir="${directory}">
          <ant:patternset>
            <ant:include name="config-*.xml"/>
          </ant:patternset>
        </ant:fileset>
      </ant:fileScanner>
      
      <!-- loop the files from the resource -->
      <j:forEach var="file" items="${files.iterator()}">
        <ant:echo message="file=${file}"/>
        
        <!-- parse out the model name from the config file name -->
        <j:set var="model"
value="${file.name.substring(7,file.name.indexOf('.xml'))}-model.gz"/>
        <ant:echo message="model=${model}"/>
        <ant:mkdir dir="${maven.build.dir}/gen-model"/>
        
        <!-- generate the model and wsdl files for this config file -->
        <ant:wscompile base="${maven.war.webapp.dir}/WEB-INF" define="true"
verbose="true" classpath="${maven.build.dest}"
model="${maven.war.webapp.dir}/WEB-INF/${model}" config="${file}">
          <ant:classpath>
            <ant:path refid="maven.dependency.classpath"/>
          </ant:classpath>
        </ant:wscompile>
        
      </j:forEach>

    </j:forEach>
    
    <!-- update any tokens in web.xml -->
    <ant:replace file="${maven.war.webapp.dir}/WEB-INF/web.xml">
      <ant:replacefilter token="@my.management.port@"
value="${my.management.port}"/>
    </ant:replace>

  </postGoal>

  <!--
    This goal creates the JAX-RPC implementation files.
    It runs after the war:war goal from the Maven war plugin.
  -->
  <postGoal name="war:war">
    <!-- define JAX-RPC ant task -->
    <ant:taskdef name="wsdeploy"
classname="com.sun.xml.rpc.tools.ant.Wsdeploy">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
      </ant:classpath>
    </ant:taskdef>

    <ant:mkdir dir="${maven.war.build.dir}/wsdeploy-generated"/>
    <ant:move file="${maven.war.build.dir}/${pom.artifactId}.war"
tofile="${maven.war.build.dir}/${pom.artifactId}-portable.war"/>

    <ant:wsdeploy
inWarFile="${maven.war.build.dir}/${pom.artifactId}-portable.war"
outWarFile="${maven.war.build.dir}/${pom.artifactId}.war"
tmpDir="${maven.war.build.dir}/wsdeploy-generated" keep="true"
verbose="true">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
      </ant:classpath>
    </ant:wsdeploy>
  </postGoal>

Client side:
  <!--
    This goal creates the JAX-RPC stubs.
    It runs after the java:compile goal from the Maven java plugin.
  -->
  <postGoal name="java:compile">
  
    <!-- define JAX-RPC ant task -->
    <ant:taskdef name="wscompile"
classname="com.sun.xml.rpc.tools.ant.Wscompile">
      <ant:classpath>
        <ant:path refid="maven.dependency.classpath"/>
      </ant:classpath>
    </ant:taskdef>
    
    <!-- extract the WSDL files from the server WAR file -->
    <j:forEach var="dep" items="${pom.dependencies}">
      <j:if test="${dep.artifactId == 'my-server'}">
        <j:set var="my.server.war"
value="${maven.repo.local}/${dep.groupId}/${dep.type}s/${dep.artifactId}-${d
ep.version}.${dep.extension}"/>
        <ant:unwar src="${my.server.war}"
dest="${maven.build.dir}/my-server">
          <ant:patternset>
            <ant:include name="**/*.wsdl"/>
          </ant:patternset>
        </ant:unwar>
      </j:if>
    </j:forEach>

        <!-- copy config files to filter values -->
    <ant:filter token="my.server.war.webinf"
value="${maven.build.dir}/my-server/WEB-INF"/>
    <ant:copy todir="${maven.build.dir}/conf" filtering="true">
      <ant:fileset dir="${maven.src.dir}/conf">
        <ant:include name="config-*.xml"/>
      </ant:fileset>
    </ant:copy>

    <!-- put config XML files in the 'files' variable -->
    <ant:fileScanner var="files">
      <ant:fileset dir="${maven.build.dir}/conf">
        <ant:patternset>
          <ant:include name="config-*.xml"/>
        </ant:patternset>
      </ant:fileset>
    </ant:fileScanner>
      
    <!-- loop the files -->
    <j:forEach var="file" items="${files.iterator()}">
      <ant:echo message="file=${file}"/>
        
      <!-- generate the client files 
      <ant:wscompile base="${maven.build.dest}" client="true" debug="true"
verbose="true" config="${file}">
      -->
      <ant:wscompile base="${maven.build.dest}" keep="true" client="true"
debug="true" verbose="true" config="${file}" features="donotoverride">
        <ant:classpath>
          <ant:pathelement location="${maven.build.dest}"/>
          <ant:path refid="maven.dependency.classpath"/>
        </ant:classpath>
      </ant:wscompile>
    </j:forEach>

  </postGoal>

I hope that is in some way helpful!

Cheers,
John

-----Original Message-----
From: Eric Chow [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 02, 2004 7:09 PM
To: Maven Users List
Subject: Maven and JWSDP-1.3 !!!

Hello,

Is there any body success change the build from Ant to Maven in the
JWSDP-1.3 ???


Eric

==========================
If you know what you are doing,
it is not called RESEARCH!
==========================


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to