I've got a maven project that will consume a number of webservices. The application will be packaged as a WAR. So far the clients' code has been generated with cxf-codegen-plugin
, in the generate-sources
phase. By default, generated sources are placed into target/generated-sources/cxf
, and after compile
, they are compiled and mixed up with the application classes in target/classes
. Both the generated and application classes can share the first level packages.
I'd like each of the clients to be packaged in its own JAR inside WEB-INF/lib
in the WAR file. I found out about -clientjar
, but it only generates the .jar
files and places them into target/generated-sources/cxf
, and the JARs also end up in target/classes
along with the compiled classes, which is pointless.
I suppose the compile
plugin at some point is compiling the generated sources into target/classes
, and possibly another phase is also moving the JARs there. Would it be possible to have Maven avoid compiling those generated sources (or even have cxf-codegen-plugin
generate no sources at all, only the JARs), and compile the application classes against the JARs generated by CXF?
I know it would be possible to achieve this by defining a multimodule project with a jar packaging module for each webservice, but I'd like to avoid this option. There can be a large number of webservices and it would not be suitable to maintain an independent module for each one. With -clientjar
I'm already forced to define a <wsdlOption>
for each WSDL in order to provide the JAR name for each WSDL (it's not possible to let cxf-codegen-plugin
just scan src/main/resources/wsdl
or <wsdlRoot>
).
Of course the client JARs could be generated outside Maven and installed to a local repository, and be defined as dependencies in the project, but I'd like to know if it's possible to do this in a single Maven build.
With assemblies I'd probably sort out how to place the JAR files generated by -clientjar
into WEB-INF/lib
but there would still be an issue with the generated classes inside the WAR.
I don't have a deep knowledge of the Maven build lifecycle and its possibilities, any suggestions or pointers are very much welcome.