Maven modules - produce artifact with a mixture of sources from multiple modules
We have a mul开发者_StackOverflowti module maven project with the following layout
project - common (contains DTOs and other utils) - business (containes business services) - presentation (presentation related)
Now, we have a webservice exposed from business module and we have to give a jar file with just service interface (from 'business' module) and DTOs (from 'common' module) to a dependent application which wants to consume the web service.
What is the best way to produce this artifact using maven?
Most elegant way I could find to solve the problem (without breaking Maven recommendation of one project, one artifact principle) is as below.
Create a maven module named web-services and use CXF-Maven plugin to generate the classes required for consuming the webservice. The artifact produced (jar) will have the required classes to be distributed to web service clients.
http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html
Removing the child module for webservice from parent project's POM xml should help (if i understood the question correctly).
精彩评论