The problem is simple… we have a service-contract maven project, which contains all the wsdls… this will be deployed on a seperate server… why not simply use the maven repo?
so there are actually two solutions… put wsdl artifact on maven or unpack the arifact. This blog entry handles only the unpacking…
The solution is to put all wsdls as jar to the maven repo. Get the artifact, unpack it and generate the server or client from the unpacked wsdls. This solution matches my problem at work and no really effort was needed… but the solution kinda sucks… later more… first the solution 😉
Create a jar and pack the wsdls with build-helper-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/main</directory>
<targetPath></targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
And then unpack it in the actual service with maven-dependency-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack</id>
<phase>initialize</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>ch.michio.test</groupId>
<artifactId>service-contracts</artifactId>
<version>1.0.0</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/service-contracts</outputDirectory>
<includes>**/*.xsd,**/*.wsdl</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Important it needs to be unpacked, before the generate-sources. Now it is in the target folder…
And finally generate it with cxf-codegen-plugin.