Our project uses xsd files as well.  before moving to maven, what we did was
to put ALL the xsd files into a single component -- now a maven project.
Then any project needing the xsd files just adds a dependency in the usual
way.

Granted this makes for extra overhead when you have multiple teams or
developers changing files in the same project - but it guarantees everyone
has the correct version of the xsd files, and also makes the pom files Much
less complicated.


On Mon, Nov 29, 2010 at 1:35 PM, Joel Schuster <[email protected]> wrote:

>
> 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