Chapter 3 walked you through a very basic example of creating a JAX-RS service. This service was a simple in-memory customer database. It was modeled as a singleton JAX-RS resource class and exchanged simple XML documents.
This chapter takes the code from Chapter 3 and shows you how to run it using the downloadable workbook example code. I’ll walk you through how the code is structured on disk as well as how the examples use the Maven build system to compile, build, and run it.
Perform the following steps:
Open a command prompt or shell terminal and change to the ex03_1 directory of the workbook example code.
Make sure your PATH is set up to include both the JDK and Maven, as described in Chapter 15.
Perform the build by typing
install. Maven uses pom.xml to figure
out what to compile, build, and run the example code.
Before we examine the build file for this example, you might want to take a quick look at the Maven utility at its Apache website at http://maven.apache.org.
Maven is a build-by-convention tool. It expects that your source code be laid out in a certain directory structure. From this standard directory structure, it knows how to automatically find, compile, and package your main class files. It also knows where your test code is and will compile and run it.