krishna2206 / java-web-mvc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java web app (MVC)

This is a simple Java web app to get started, using the MVC pattern.

Pre-requisites

  • Java 11
  • Maven 3
  • Apache Tomcat 9

How to build and deploy

If a tomcat server is already installed and running, you can build and deploy the app with one of the following methods:

Deploy with maven

Before deploying with maven, add the following to your settings.xml file.

There are two locations where the settings.xml file may be found:

  • The Maven install: ${maven.home}/conf/settings.xml
  • A user’s install: ${user.home}/.m2/settings.xml
    <server>
      <id>TomcatServer</id>
      <username>admin</username>
      <password>admin</password>
    </server>

NB: The username and password are the ones you use to log into the tomcat server.

Then, run the following command:

    mvn tomcat9:deploy

Build and deploy manually

If you don't use maven, you can build the app and copy the war file to the tomcat webapps folder.

    mvn clean package
    cp target/*.war /path/to/tomcat/webapps

How to run

If you deployed with maven/build and deployed manually

If you neither deployed with maven nor build and deployed manually

There is a method which allows you to run the app without deploying it. This is useful for development purposes.

    mvn tomcat9:run

About


Languages

Language:Java 97.1%Language:JavaScript 2.9%