Skip to main content Skip to complementary content

Working with a REST sample in Eclipse


  1. From a command-line windows, navigate to the jax-rs folder and type mvn clean install eclipse:eclipse. This will create an Eclipse project out of this sample that we can import into Eclipse.
  2. From Eclipse we can now import the project. From the Menu row, select File : Import..., and from the resulting Import popup, choose Existing Projects into Workspace (see illustration below). Select Next.
  3. Select the four Eclipse projects comprising this example: jaxrs-intro-client, jaxrs-intro-common, jaxrs-intro-service-bundle, and jaxrs-intro-service-war. You'll see them listed in the left-side Eclipse Navigator and Project Explorer views. At this stage any of the files can be viewed and modified. Be sure to run mvn clean install from the jaxrs-intro folder within a command prompt window after any changes made.
  4. Prior to running the client, we'll need to activate the REST service, which we can do in at least two ways:
    • To run the example within Talend ESB, we'll need to create the Karaf features file that contains the definition for this service. First, from a command prompt navigate to the features folder (sibling to jaxrs-intro) and run mvn clean install. Next, from the command prompt enter feature:repo-add mvn:com.talend.sf.examples/osgi/1.0/xml/features to install the features file followed by feature:install tsf-example-jaxrs-intro to install the JAXRS-Intro service.

    • To run the example within CXF's internal (Jetty-based) servlet container, navigate to the war folder and run mvn jetty:run.

  5. To run the client, from a command prompt in the jaxrs-intro/client folder, run mvn exec:java.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!