Maven POM Information
To use CXF within Maven, you'll need to declare the CXF dependencies in your POM. The CXF groupId is "org.apache.cxf". Here is a small example:
<properties> <cxf.version>2.2.3</cxf.version> <properties> <dependencies> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-frontend-jaxws</artifactId> <version>${cxf.version}</version> </dependency> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http</artifactId> <version>${cxf.version}</version> </dependency> <!-- Jetty is needed if you're are not using the CXFServlet --> <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-transports-http-jetty</artifactId> <version>${cxf.version}</version> </dependency> </dependencies>
For CXF 2.0.6 and later versions, you don't need to specify any repositories as the artifacts are available in the central repository. For information on using Maven with CXF and Tomcat, this blog entry may be helpful.
Additional Dependencies
Depending on your usage of CXF, you may need to bring in additional dependencies--the mvn install process will usually make clear what you are missing. Here's a non-exhaustive list of additional CXF artifacts that may be needed:
<!-- Use dependency blocks for these CXF artifact Ids just as above --> cxf-rt-core cxf-rt-frontend-simple cxf-rt-frontend-jaxws cxf-rt-databinding-aegis cxf-rt-transports-local cxf-rt-transports-http cxf-rt-transports-http-jetty cxf-rt-transports-jms cxf-rt-management cxf-common-utilities
Maven Snapshot Repository
To work with the latest non-release versions of CXF (not recommended for production use), updated nightly, change the CXF version to the -SNAPSHOT version desired and add the Apache snapshot repository to both the repositories and pluginRepositories sections:
<repositories> ...other repos... <repository> <id>apache-snapshots</id> <name>Apache SNAPSHOT Repository</name> <url>http://repository.apache.org/snapshots/</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> </respositories> <pluginRepositories> ...other repos... <pluginRepository> ...same repo as above... </pluginRepository> </pluginRepositories>
The addition to the plugin repositories section is needed because the cxf-codegen-plugin, used for the WSDL2Java, Java2WS, etc. tasks, is downloaded using that entry.