2009/9/3 Tahmasebi, Hamid Reza <[email protected]>:
> Hi,
>
> I'm running into an issue with Maven's JAXB2 plugin. I have 2 different 
> schemas (aaaaTestCaseSchema.xsd and bbbbTestCaseSchema.xsd) and want 2 
> different packages (com.tmp.aaaa.dataDrivenTests and 
> com.tmp.bbbb.dataDrivenTests) for those schemas. I followed the 
> recommendation in plugin's FAQ page 
> (http://mojo.codehaus.org/jaxb2-maven-plugin/faq.html 
> <https://owa.ku.edu/exchweb/bin/redir.asp?URL=http://mojo.codehaus.org/jaxb2-maven-plugin/faq.html>
>  ) and created 2 executions in JAXB2 plugin declaration with each execution 
> having its own configuration declaration. In each configuration I specified 
> the schema and package to be run for that execution. The problem is that the 
> last execution always overwrites the first generated files, i.e., the plugin 
> generates com.tmp.aaaa.dataDrivenTests package and its associated java files 
> underneath this package and then overwrites it with 
> com.tmp.bbbb.dataDrivenTests package and its java files when it runs the 
> second execution. Here is my plugin declaration in pom.xml:
>
>

My XSD are not located in the test folder but i shouldn't matter.

Here is what I do, my project is organized like this:
src
  + main
     +  xsd
      |   + aaaa.xsd
      |   + bbbb.xsd
     +  xjb
          + aaaa.xjb
          + bbbb.xjb

.xjb files are used to configure the JAXB Binding and contain the
target package name. aaaa.xjbd contain something like this:

<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc";
jxb:extensionBindingPrefixes="xjc">
    <jxb:bindings schemaLocation="../xsd/aaaa.xsd" node="/xs:schema">
        <jxb:schemaBindings>
            <jxb:package name="com.mycompany.myproject.aaaa.xml"/>
        </jxb:schemaBindings>
        <jxb:globalBindings>
            <xjc:simple/>
        </jxb:globalBindings>
    </jxb:bindings>
</jxb:bindings>

And I only have one plugin execution configuration:
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.2</version>
                <configuration>
                    <arguments>-extension</arguments>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Gérald

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to