Jaxb 2 Maven Plugin - how to make maven respect XSD namespaces?

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>

Answers


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


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.


Need Your Help

Destroy a session of another user in spring

spring session spring-security sessionid

In my application, I have an admin that can delete users. so when I delete a user from the admin session I want that the deleted user should get logged out automatically.

Redirecting /page/xx/ if 404 - IIS / WordPress

wordpress url iis rewrite http-status-code-404

Running WordPress (PHP / MySQL) on Windows Server 2012 R2 / IIS.