Maven Plugin for Tomcat 9

I did not find any tomcat-maven plugin except tomcat7-maven module. Can I use it with apache-tomcat-9.0.0.M15?

+7
source share
1 answer

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> 
+5
source

Source: https://habr.com/ru/post/1261894/


All Articles