Yes, you can use it. I tried and it worked for me on tomcat 9
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>TomcatServer</server> <path>/myapp</path> </configuration>
Maven goals:
mvn tomcat7:deploy mvn tomcat7:undeploy mvn tomcat7:redeploy
Note. Remember to add tomcat user to tomcat-users.xml and maven settings.xml
user.xml-cat
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="manager-gui,manager-script" /> </tomcat-users>
Role
manager-script allows applications, i.e. maven, deploy jar / war for the application server.
Maven.xml Settings File
<?xml version="1.0" encoding="UTF-8"?> <settings ...> <servers> <server> <id>TomcatServer</id> <username>admin</username> <password>password</password> </server> </servers> </settings>
source share