Skip to content

ashwinreddyash/java-tomcat-maven-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-tomcat-maven-example

This is an example ready-to-deploy java web application built for Tomcat using Maven and webapp-runner.

Running Locally

(need maven and java installed)

mvn package
java -jar target/dependency/webapp-runner.jar target/*.war

The application will be available on http://localhost:8080.

How This Was Built

  1. Generate the project using a Maven archetype:

    mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp
    
  2. Add the webapp-runner plugin into the pom.xml:

    <build>
      <!-- ... -->
      <plugins>
        <!-- ... -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.3</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals><goal>copy</goal></goals>
              <configuration>
                <artifactItems>
                  <artifactItem>
                    <groupId>com.github.jsimone</groupId>
                    <artifactId>webapp-runner</artifactId>
                    <version>8.5.11.3</version>
                    <destFileName>webapp-runner.jar</destFileName>
                  </artifactItem>
                </artifactItems>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
    

About

Example Java + Maven Tomcat application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 57.8%
  • Dockerfile 42.2%