I have several web services I need to integrate with, and I can do this by building web service clients using the wsimport plugin for Maven. The web services in question all reference enterprise-common schema files, so generating a separate client results in duplicate code, where each web service client jar contains an implementation of the same schema.
I wanted to reduce this redundant code, so my first thought was to build a stand-alone jar just with the common code generated from the common schema. The problem here is that when I use maven to generate a web service client from a WSDL, it will still build code for all schemas references by the WSDL - how do I tell maven to not generate code for the common schema files, because the code is already in a referenced library?
I did try this:
<resources>
<resource>
<directory>${basedir}/wsdl</directory>
<excludes>
<exclude>**/my_schema.xsd</exclude>
</excludes>
</resource>
</resources>
But wsimport still generates code for my_schema.xsd
even though I created a dependency for the jar that already contains this code:
<dependencies>
<dependency>
<artifactId>MyCommonCode</artifactId>
<groupId>com.myCompany</groupId>
<version>1.0.0</version>
</dependency>
</dependencies>