'JAXB how to resolve 'is already defined' error when two XSD's without target namespace declare the same element

I have an element that is repeated in multiple xsd files that don't have a target namespace. While trying to generate java classes I am getting is already defined error.

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>2.5.0</version>
    <executions>
      <execution>
        <id>xsd-to-java</id>
        <goals>
          <goal>xjc</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <packageName>client.dto</packageName>
    </configuration>
  </plugin>

I tried adding bindings for different schema to different package and still getting the same error. Has someone who has found a way to fix this please help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source