Creating a Maven project

Create a Maven project in the Eclipse IDE for JSON processing. Select File | New | Other, and in the New gallery, select Maven | Maven Project, as shown here:

Creating a Maven project

In the New Maven Project wizard, select Create a simple project and click on Next, as shown in the following screenshot:

Creating a Maven project

Specify Group Id (jboss-json), Artifact Id (json), Version (1.0), Packaging (war), and Name (json) for New Maven Project and click on Finish, as shown here:

Creating a Maven project

A new Maven project gets created as shown here:

Creating a Maven project

Next, add JSPs to process JSON. Add createJson.jsp to create JSON and add parseJson.jsp to parse JSON. Select File | New | Other, and in the New gallery, select Web | JSP File and click on Next, as shown here:

Creating a Maven project

Select the webapp folder, specify File name (createJson.jsp), and click on Finish, as shown here:

Creating a Maven project

The createJson.jsp file gets added to the Maven project. Similarly, create parseJson.jsp. The directory structure of the Maven web application in the Eclipse IDE is shown in the following screenshot:

Creating a Maven project

Add the jboss-json-api_1.0_spec, webapp-javaee7 and javax.ws.rs-api dependencies to pom.xml:

  <dependencies>

    <dependency>
      <groupId>org.jboss.spec.javax.json</groupId>
      <artifactId>jboss-json-api_1.0_spec</artifactId>
      <version>1.0.0.Final</version>
    </dependency>

    <dependency>
      <groupId>org.codehaus.mojo.archetypes</groupId>
      <artifactId>webapp-javaee7</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.0</version>
    </dependency>
    
  </dependencies>

Note

The complete pom.xml file is available in the code download for this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.217.151