Running an application

Now we are done with coding. Let's run the coding and see how it works. The project is a web application, so it requires a servlet container to run. We will use the Tomcat container here. Add the following build plugin for the Tomcat that can actually host a Tomcat instance right from Maven and no installation is required:

    <build>
….
  <plugins>
  <plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.1</version>
  </plugin>
  </plugins>
    </build>

This will download all the dependencies from the repository. After the download is complete, right-click on the project, choose Run As | Run Configurations..., create the configuration in the configuration window specifying Goals as tomcat7:run, and click on Run, as shown in the following screenshot:

Running an application

Note

The Tomcat plugin has the run goal, which compiles and runs the application.

Similarly, we can add any other container and run the application in it. The running application will be available at http://localhost:8080/MyDistance/ and would look like the following screenshot (shown with a sample conversion):

Running an application
..................Content has been hidden....................

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