I have an Eclipse project that uses the Maven jaxb2 plugin
to generate POJOs from an .xsd.  Castor then uses those POJOs to pass data
into a method in my web service application.  So now when the .xsd is
updated a quick 'mvn package' is all that's needed to update the POJOs and
expose new/updated POJO methods to my code.  I would like to transition
that to Castor because I still need to manually update the Castor mapping file
(castor-mapping.xml) when the .xsd changes.  Is there a Castor plugin that
will generate POJOs and the mapping file from an .xsd?  The documentation
for castor-maven-plugin here:
http://static.highsource.org/mjiip/maven-jaxb2-plugin/generate-mojo.html#generatePackage
hints that it might be possible but I can't get it to work correctly if that's
the way to go.  Is there a tutorial around anywhere?  I've Googled
for a few hours myself.  Here is the maven2 pom plugin that I'm using,
which is throwing errors all over the place probably because I don't know what
I'm doing:

      <plugin>

       
<groupId>org.codehaus.mojo</groupId>

       
<artifactId>castor-maven-plugin</artifactId>

        <version>2.0</version>

        <configuration>

           
<schema>src/main/webapp/WEB-INF/orderService.xsd</schema> 

           
<resourceDestination>src/main/java</resourceDestination>

            <dest>src/main/java</dest>


           
<packaging>com.ideeksha.order.webservice</packaging> 

           
<generateMappings>true</generateMappings> 

           
<warnings>true</warnings>                             


        </configuration>

        <executions>

          <execution>

           
<goals>

             
<goal>generate</goal>

           
</goals>                
                     


          </execution>

        </executions>

      </plugin>    



Here is my jaxb2 plugin in my pom that works.  I would hope that moving
this out in favor of a Castor plugin (with no changes to any other project
files) should be a straightforward thing to do

            <plugin>

               
<groupId>org.jvnet.jaxb2.maven2</groupId>

               
<artifactId>maven-jaxb2-plugin</artifactId>

               
<executions>

               
<execution>

               
<goals>

               
    <goal>generate</goal>

               
</goals>

             
    <configuration>

             
        <schemaDirectory>src/main/webapp/WEB-INF</schemaDirectory>

               
   
<generatePackage>com.ideeksha.order.webservice</generatePackage>

               
   
<generateDirectory>src/main/java</generateDirectory>  

               
    <forceRegenerate>true</forceRegenerate>

             
    </configuration>       
        

               
</execution>

               
</executions>

            </plugin>

Reply via email to