0

Could anyone provide simple configuration of Jersey and Embedded Tomcat in: 1) pom.xml 2) main method

I was trying to find it in google search, but they propose to use grizzly, glassfish and etc.

Thanks a lot.

Mokko Field
  • 43
  • 1
  • 2
  • 11

1 Answers1

0

I would go for webapp-runner to run the web app. It deploys the maven generated war from /target into a built in tomcat container. This is how java applications gets deployed on Heroku.
pom plugin configuration:

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

Dependency:

    <dependency>
        <groupId>com.github.jsimone</groupId>
        <artifactId>webapp-runner</artifactId>
        <version>7.0.34.1</version>
        <scope>provided</scope>
    </dependency>

to run the application after mvn clean package

java -jar target\dependency\webapp-runner.jar target\myapp.war
Dharmi
  • 1,396
  • 1
  • 9
  • 5