官方不存在tomcat10-maven-plugin插件
Maven 中央仓库中没有官方的tomcat10-maven-plugin。Apache Tomcat Maven 插件项目目前仅对以下插件提供官方支持:
tomcat6-maven-plugin
tomcat7-maven-plugin
tomcat8-maven-plugin
tomcat9-maven-plugin
如果你想使用 cargo 命令来跑支持 Jakarta EE 的 Tomcat 10 及以上版本,我目前验证可行的方案就是在pom.xml做如下的配置:
<plugins><plugin><groupId>org.codehaus.cargo</groupId><artifactId>cargo-maven3-plugin</artifactId><version>1.10.6</version><configuration><container><containerId>tomcat10x</containerId><type>installed</type><!-- Point to your Tomcat installation --><home>/Users/liaowenxiong/Applications/apache-tomcat-10.1.30</home></container><configuration><properties><cargo.servlet.port>8888</cargo.servlet.port><cargo.context.path>/redis-practice</cargo.context.path></properties></configuration></configuration></plugin>
这样你再执行 mvn cargo:run,java web 项目可以跑起来,jdk 17,servlet 是 jakarta.servlet-api