It sounds like Eclipse (Kepler) does not have a proper plugin for Tomcat 8. I want to deploy my .war into Tomcat 8 and run it by Maven pom.xml file. Can anyone provide me step-by-step guidance or any resources, please?
My POM file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Test-App</groupId>
<artifactId>test-rest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>test-rest Maven Webapp</name>
<url>http://maven.apache.org</url>
<!-- Tomcat plugin -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/${project.build.finalName}</path>
<update>true</update>
<url>http:// localhost:8080/manager/text</url>
<username>tomcat</username>
<password>tomcatuser</password>
</configuration>
</plugin>
</plugins>
<finalName>test-rest</finalName>
</build>
</project>
Just in case you use a separate Tomcat local server. If you use embedded tomcat, this is not applicable.
In your pom.xml, add the tomcat plugin. (You can use this for both Tomcat 7 and 8):
pom.xml
tomcat-users.xml
settings.xml (maven > conf)
* deploy/re-deploy
mvn tomcat7:deploy OR mvn tomcat7:redeploy
Tried this on (Both Ubuntu and Windows 8/10):
* Jdk 7 & Tomcat 7
* Jdk 7 & Tomcat 8
* Jdk 8 & Tomcat 7
* Jdk 8 & Tomcat 8
Tested on Both Jdk 7/8 & Tomcat 7/8. (Works with Tomcat 8.5 Also, will test Tomcat 9 soon)
Note:
Tomcat manager should be running or properly setup, before you can use it with maven.
Can you use the cargo pluygin instead, this works for me, deploying to tomcat8 :
Example of how to run your war with cargo & tomcat8
If you want to add it to your pom
Then to run you war (if your pom is a war)
To run with debug (memory options not necessary)
Then you need to create a remote debug configuration in your IDE on port 8000 (port by default if nothing specified)
More commands here : https://codehaus-cargo.github.io/cargo/Maven2+plugin.html#Maven2plugin-TheCargoMavenpluginindetail
For Tomcat 8, you should use cargo-maven2-plugin, which works for both maven 2 and maven 3. When configuration cargo plugin, make sure that the value for Container Id is "tomcat8x". Do NOT omit the "x" after tomcat8.