0

I have a question according to any jaxb2 plugins for maven. I want to generate sources from XSD schema. Normally if I run xjc from command line xjc generates all the sources according to their namespaces (like core:AccountType to core/AccountType.java etc.)

cmd> xjc PublEnvlp.xsd

I want to use same feature using some of maven plugins but it creates all java classes to one directory so there are duplication conflicts. Is there any flag, plugin, feature, ... to make maven work same as command line xjc command? I am using code below in maven:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.3.1</version>
<executions>
    <execution>
        <id>xjc</id>
        <goals>
            <goal>xjc</goal>
        </goals>
        <configuration>
            <packageName>package.name</packageName>
            <schemaDirectory>src/main/resources/DataArchitecture/XML/RDF/Physical_Xml</schemaDirectory>
            <forceRegenerate>true</forceRegenerate>
            <verbose>true</verbose>
        </configuration>
    </execution>
</executions>

Jean-Rémy Revy
  • 5,607
  • 3
  • 39
  • 65
Jiri Vlasimsky
  • 684
  • 6
  • 13

2 Answers2

0

Try it without <packageName>package.name</packageName>, it should put them in appropriate subdirectories.

Edit: you might have more luck with the org.jvnet.jaxb2.maven2:maven-jaxb2-plugin

artbristol
  • 32,010
  • 5
  • 70
  • 103
0

maven-jaxb2-plugin invokes XJC and this respects namespaces. You may use bindings to customize package names, but even without that you should be getting package names based on namespaces. You probably have a problem somewhere else.

lexicore
  • 42,748
  • 17
  • 132
  • 221