Tag Archives: tomcat8-maven-plugin

Maven: How to uses tomcat8 Maven plugin

After searching a bunch of articles on the Internet, we found no solution, only the plugin of tomcat7 Maven plugin, as follows:

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

There is no plugin for tomcat8 Maven plugin. There is no such plugin in Maven’s central warehouse

https://repository.apache.org/content/repositories/snapshots/org/apache/tomcat/maven/

One was found in the MVN repository

Adding the above dependency to pom.xml either prompts that the dependency cannot be found or cannot be downloaded. After searching for a long time, we found a solution, which is to use & lt; in Maven; pluginRepositories> ,& lt; pluginRepositories> It is used to configure the plug-in address, because all functions of Maven are implemented by plug-ins, so you need to download the plug-in package from a specific address

Add the following to POM. XML

<pluginRepositories>   
	  <pluginRepository>   
		<id>alfresco-public</id>    
		<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>   
	  </pluginRepository>    
	  <pluginRepository>   
		<id>alfresco-public-snapshots</id>    
		<url>https://artifacts.alfresco.com/nexus/content/groups/public-snapshots</url>    
		<snapshots>   
		  <enabled>true</enabled>    
		  <updatePolicy>daily</updatePolicy>   
		</snapshots>   
	  </pluginRepository>    
	  <pluginRepository>   
		<id>beardedgeeks-releases</id>    
		<url>http://beardedgeeks.googlecode.com/svn/repository/releases</url>   
	  </pluginRepository>   
  </pluginRepositories>

Add the tomcat8-maven-plugin dependency

<plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat8-maven-plugin</artifactId>
          <version>3.0-r1655215</version>
          <configuration>
		<url>http://localhost:8080/manager/html</url>
		<server>tomcat</server>
	 </configuration>
        </plugin>

Then you can use tomcat8-maven-plugin plugin.

When you deploy for the first time, you can change the command to tomcat8:redeploy when you redeploy.