Here is a small Example of what I would like to achieve:
Maven Artifact A is one of many Webservices and defines a XSD Schema with definitions for Requests and Response
I think your question is reasonable. In the past I have often found that I have a Maven module that needs to do special processing on files that can be found in dependent JARs.
What I have done in the past is to make Artifact B a dependency of Artifact A. Then in the pom.xml of Artifact A I use a special configuration of the Maven dependency plugin as follows:
<plugin>
<!-- Used to pull XSD files from the JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-xsd-files</id>
<!-- Using the initialize phase because it is before the generate sources phase -->
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<!-- Artifact that Holds our custom templates -->
<groupId>com.mycorp</groupId>
<artifactId>artifact-b</artifactId>
<version>${artifact-b.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<includes>**/*.xsd</includes>
<outputDirectory>${project.basedir}/target/xsd-includes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Now your XSD files of interest can be found in the target directory of Artifact A and from there you can do anything you want with them. You can include them as resources, reference them from other XSD files, embed them in your own JARs or whatever! As you can see from the configuration, you also don't have to put them in your target directory; you could put them directly into your /src/main/resources
directory.
You can add this configuration to any Maven module you want so that multiple modules can all work the same way. The nice thing about this approach is that it will also work from with Eclipse via M2Eclipse.