Apache CXF Eclipse Maven tutorial
Oct 27
In this tutorial, I am going to explain easiest way how to start developing web-services with Apache CXF using Maven as build manager on Eclipse IDE.
**UPDATE: here you can download parent-independent pom.xml for this project. (your project dont need to be in cxf working directory)
Requirements:
IDE: Eclipse Indigo (download link)
IDE Plugins:
M2E (installation tutorial link)
CheckStyle (installation link – eclipse resource)
PMD (installation link – eclipse resource)
Source code management: GIT (installation tutorial link)
Build manager: Maven 3.0.3 (installation link)
Steps:
1.
Open your terminal and navigate to folder where you want to have cxf. Get apache cxf examples from the internet:
1 | git clone git://git.apache.org/cxf.git |
Go into cxf:
1 | cd cxf |
2.
Build the examples without tests (taking too much time)
1 | mvn -Pfastinstall |
Note: You should run command above more times if necessary.
3.
In this tutorial we are talking about startup with webservices, so we are going to use “wsdl_first” project from examples. We should navigate there. (I presume you are still in cxf folder)
1 | cd distribution/src/main/release/samples/wsdl_first |
4.
We need to build maven for eclipse project with following command:
1 2 | mvn install mvn eclipse:eclipse |
5.
Open eclipse. Then open wizard on File -> Import -> Existing Maven Projects. Browse then for “cxf\distribution\src\main\release\samples\wsdl_first”. And if you see pom.xml (checked), click finish.
Now you can run example webservices in eclipse (with run option) or from the command line window with:
To start server:
1 | mvn -Pserver |
To start client:
1 | mvn -Pclient |
6.
Start coding and enjoy ![]()
P.S. if you experience some problems while running the example project you should clean it:
1 | mvn clean |
Then go to the step 4 again.
