No, i don't think so. In my opinion the problem occurs, because two object 
factories are generated under the same package. That is obviously not possible, 
as both factories create different classes but will have the same name. So this 
is a collision. Try to put the xsd's under different subdirectories. 
E.g. 
xsd/dir1/...xsd.
xsd/dir2/...xsd . 

I had once the same problem. Unfortunately, i'm not totally sure how i solved 
it. :/

I would suggest to try around a little. Maybe remove the duplicate entries, see 
if it works then. If it does, move them to another file and generate the files. 
If this works, try to import it and see if it works then. If the directory 
approach does not work, i would suggest to start a small project, in which you 
create two (easier) xsd files. Try to generate classes for them. Then try to 
generate the error with these files. Always the most important thing is to get 
an understanding why something fails. I then like to have a more easy setup to 
test. Unfortunately i don't have time to reproduce your error. So you have to 
do the research on your own. 


-----Ursprüngliche Nachricht-----
Von: Andrew Hughes [mailto:ahhug...@gmail.com] 
Gesendet: Dienstag, 1. Dezember 2009 14:09
An: Maven Users List
Betreff: Re: jaxb2-maven-plugin : Two declarations cause a collision

Could it possibly be that I need to use xjb's to resolve the collision and
not plugin configuration?


On Tue, Dec 1, 2009 at 11:32 PM, Andrew Hughes <ahhug...@gmail.com> wrote:

> Thanks Again!
>
> You are correct, ogckml22.xsd does import atom-author-link.xsd. Initially I
> was only running a single <execution> for ogckml22.xsd. I switched to two
> because the FAQ <http://mojo.codehaus.org/jaxb2-maven-plugin/faq.html>said 
> that's how to resolve the collision.
>
> I've still got no idea how to fix this, but thanks for helping so far.
>
>
> On Tue, Dec 1, 2009 at 11:16 PM, Entner Harald <entner.har...@afb.de>wrote:
>
>> 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:ahhug...@gmail.com]
>> 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 <entner.har...@afb.de>
>> wrote:
>>
>> > Hi Andrew,
>> >
>> > try removing the packageName in the pom.xml file.
>> >
>> > -----Ursprüngliche Nachricht-----
>> > Von: Andrew Hughes [mailto:ahhug...@gmail.com]
>> > 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: users-unsubscr...@maven.apache.org
>> > For additional commands, e-mail: users-h...@maven.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to