John Eipe
John Eipe

Reputation: 11228

Maven tomcat:run issue

I tried running the Spring PetClinic project from eclipse (with m2e plugin installed).

My pom.xml config,

<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
    <server>tomcat-development-server</server>
    <port>9966</port>
    <path>/petclinic</path>
</configuration>
</plugin>

But when I do tomcat:run from eclipse I get this log,

[INFO] <<< tomcat-maven-plugin:1.1:run (default-cli) < compile @ spring-petclinic <<<
[INFO] 
[INFO] --- tomcat-maven-plugin:1.1:run (default-cli) @ spring-petclinic ---
[INFO] Running war on http://localhost:8080/spring-petclinic

But when I check if the app is up nothing comes up. I tried both -

http://localhost:8080/spring-petclinic/
http://localhost:9966/petclinic/

Please advice.

Upvotes: 0

Views: 535

Answers (2)

viniciusartur
viniciusartur

Reputation: 161

The goal you should use is:

tomcat7:run

Instead:

tomcat:run

That's why in your log appears:

tomcat-maven-plugin:1.1 and port 8080

Instead:

tomcat-maven-plugin:2.2 and port 9966

Upvotes: 0

Vy Do
Vy Do

Reputation: 52516

Try something like this: pom.xml

<plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.2</version>
  <configuration>
    <path>/</path>
  </configuration>
</plugin>

Use command:

mvn clean install tomcat7:run

If still error, check what are under the hood by command:

mvn -X tomcat7:run

Reference: http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/plugin-info.html

Upvotes: 1

Related Questions