Hi Andrew, it looks like that ogckml22.xsd File imports the atom-author-link.xsd File. So isn't it sufficient to run the jaxb plugin for ogckml22.xsd only?
-----Ursprüngliche Nachricht----- Von: Andrew Hughes [mailto:[email protected]] Gesendet: Dienstag, 1. Dezember 2009 13:29 An: Maven Users List Betreff: Re: jaxb2-maven-plugin : Two declarations cause a collision Hi Entner - THANK YOU for the reply and suggestion. I am still encountering the same problem :'( I'm not sure what to do here because as far as I can tell this should work. I have tried this with and without the packageName (as below): <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <id>ogckml22</id> <configuration> <schemaFiles>ogckml22.xsd</schemaFiles> <staleFlag> ${project.build.directory}/generated-sources/jaxb/.staleFlag-ogckml22 </staleFlag> </configuration> <goals> <goal>xjc</goal> </goals> </execution> <execution> <id>atom-author-link</id> <configuration> <schemaFiles>atom-author-link.xsd </schemaFiles> <staleFlag> ${project.build.directory}/generated-sources/jaxb/.staleFlag-atom-author-link </staleFlag> </configuration> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <packageName>java.lunch20091126xml.kml</packageName> </configuration> </plugin> On Tue, Dec 1, 2009 at 10:00 PM, Entner Harald <[email protected]> wrote: > Hi Andrew, > > try removing the packageName in the pom.xml file. > > -----Ursprüngliche Nachricht----- > Von: Andrew Hughes [mailto:[email protected]] > Gesendet: Dienstag, 1. Dezember 2009 12:13 > An: Maven Users List > Betreff: jaxb2-maven-plugin : Two declarations cause a collision > > Hi All, > > I am trying to generate classes for the Google/OGC KML 2.2 XSD's with > the jaxb2-maven-plugin > (http://mojo.codehaus.org/jaxb2-maven-plugin/index.html). > > - http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd > - http://schemas.opengis.net/kml/2.2.0/atom-author-link.xsd > > Both XSD's have an element: > > - > > <element name="name" type="string"/> > > > Which fails giving: > > - "Two declarations cause a collision in the ObjectFactory class" > > This I am ok with, but the resolution is confusing me, this problem is even > in the plugin's FAQ page ( > http://mojo.codehaus.org/jaxb2-maven-plugin/faq.html): > > *I have different schemas and want different packages for those schemas, > how > do I do this?* > > *You want to create multiple executions in your plugin declaration. This > will allow you to have multiple configuration declarations and you can > specify the schema and package to be run for that execution. In your > configuation, you will need to have a different staleFile for each > execution, so it will be able to determine if the xjc needs to be > executed.* > > I have tried to add two seperate <executions> like the FAQ says, but it > still fails :'( Possibly because ogckml22.xsd includes the > atom-author-link.xsd? > > <build> > <plugins> > <plugin> > <groupId>org.codehaus.mojo</groupId> > <artifactId>jaxb2-maven-plugin</artifactId> > <version>1.2</version> > <executions> > <execution> > <id>ogckml22</id> > <configuration> > <packageName>java.lunch20091126xml.binding.kml</packageName> > <schemaFiles>ogckml22.xsd</schemaFiles> > > <staleFlag>${project.build.directory}/generated-sources/jaxb/.staleFlag-ogckml22</staleFlag> > </configuration> > <goals> > <goal>xjc</goal> > </goals> > </execution> > <execution> > <id>atom-author-link</id> > <configuration> > <packageName>java.lunch20091126xml.binding.atom</packageName> > <schemaFiles>atom-author-link.xsd</schemaFiles> > > <staleFlag>${project.build.directory}/generated-sources/jaxb/.staleFlag-atom-author-link</staleFlag> > </configuration> > <goals> > <goal>xjc</goal> > </goals> > </execution> > </executions> > </plugin> > > > ANY help would be absolutely fantastic!!!!! > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
