This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • Using CXF with maven
Skip to end of metadata
Go to start of metadata

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 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>
</repositories>

<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.

  • No labels

3 Comments

  1. The java2ws plugin also supports a universal argline option that can be used to make use of functionality that is available in the ant task or command line version of java2ws.

    To have the service schema generated to a separate file you can use this:

    <configuration>
       ..
       <argline>-createxsdimports</argline>
       ..
    </configuration>
    

    If you are using the genWrapperbean option, the generated sources and class files are stored in the project base directory. Using the argline option you can have the class files along with your other compiled classes using this:

    ..
    <argline>-classdir ${project.build.outputDirectory}</argline>
    ..