I have a couple projects in that use XJC via the org.jvnet.jaxb2.maven2 plugin.

The problem I'm running into is when the XSD of one project depends on the XSD 
of another.

I can't seem to find a good 'maven-esq' way to deal with this. Right now I'm 
unpacking the xsds from the dependency jars (via the maven-dependency-plugin) 
and referencing them using a relative path:

Ex:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
                        <execution>
                                    <id>unpack-dependancies</id>
                                    <phase>process-resources</phase>
                                    <goals>
                                                <goal>unpack</goal>
                                    </goals>
                                    <configuration>
                                                <artifactItems>
                                                            <artifactItem>
                                                                        
<groupId>com.company</groupId>
                                                                        
<artifactId>parent.project</artifactId>
                                                                        
<version>0.0.1-SNAPSHOT</version>
                                                                        
<type>jar</type>
                                                                        
<overWrite>false</overWrite>
                                                                        
<outputDirectory>${project.build.directory}/dependencies/parent.project</outputDirectory>
                                                                        
<includes>**/*.xsd,**/*.xjb</includes>
                                                            </artifactItem>

...

In child.xsd

<import 
schemaLocation="../../../../target/dependencies/parent.project/schema/parent.xsd"
 ...

Seems there should be a way to reference a file within a maven dependency 
without having to unpack it first.

Thoughts?

Reply via email to