Is the tomcat7-maven-plugin
working with a tomcat 8 server and java 8? I can't find any tomcat8-maven-plugin
.
Tomcat 8 Maven Plugin for Java 8
125.8k views Asked by myborobudur AtThere are 6 answers
Since November 2017, one can use tomcat8-maven-plugin:
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.maven/tomcat8-maven-plugin -->
<dependency>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>2.2</version>
</dependency>
Note that this plugin resides in ICM repo (not in Maven Central), hence you should add the repo to your pluginsRepositories in your pom.xml:
<pluginRepositories>
<pluginRepository>
<id>icm</id>
<name>Spring Framework Milestone Repository</name>
<url>http://maven.icm.edu.pl/artifactory/repo</url>
</pluginRepository>
</pluginRepositories>
Plugin run Tomcat 7.0.47:
mvn org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run
...
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
This is sample to run plugin with Tomcat 8 and Java 8: Cargo embedded tomcat: custom context.xml
Almost 2 years later....
This github project readme has a some clarity of configuration of the maven plugin and it seems, according to this apache github project, the plugin itself will materialise soon enough.
groupId and Mojo name change Since version 2.0-beta-1 tomcat mojos has been renamed to tomcat6 and tomcat7 with the same goals.
You must configure your pom to use this new groupId:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
Or add the groupId in your settings.xml
.... org.apache.tomcat.maven ....
Yes you can,
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
ORmvn tomcat7:redeploy
Tried this on (Both Ubuntu and Windows 8/10):
Tested on Both Jdk 7/8 & Tomcat 7/8. (Works with Tomcat 8.5 and 9)
Note:
Tomcat manager should be running or properly setup, before you can use it with maven.
Good Luck!