用于嵌入式 Tomcat 8.5 的 Tomcat Maven 插件

2024-01-06

我正在运行 Spring Web 应用程序,但无法使用 Tomcat 8.5 在最新的 Eclipse 中执行嵌入式 tomcatTomcat 7 Maven 插件 http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/usage.html, 我在跑 tomcat7:run-warWindows 上的目标,但未能将其配置为运行 Tomcat 8.5,它不断寻找 tomcat 7 文件夹。

tomcat7:run-war 使用嵌入式 Tomcat 服务器将当前项目作为打包的 Web 应用程序运行。

I found answer https://stackoverflow.com/questions/26883836/tomcat-8-maven-plugin-for-java-8/35058957#35058957 or 这个答案 https://stackoverflow.com/questions/37370927/jenkins-deploy-war-file-to-tomcat-8但这有利于部署雄猫。

我发现在已删除的链接 https://artifacts.alfresco.com/nexus/content/groups/public/org/apache/tomcat/maven/tomcat8-maven-plugin/3.0-r1655215/tomcat8插件。相关吗?

I found issue https://issues.apache.org/jira/projects/MTOMCAT/issues/MTOMCAT-234?filter=allopenissues建议使用 spring boot 功能,有人可以提供更多详细信息吗?

看来这个项目已经死了,我建议你考虑使用 Spring Boot,它具有非常相似的功能:https://spring.io/projects/spring-boot https://spring.io/projects/spring-boot

尤其是当春季启动 2.1 https://docs.spring.io/spring-boot/docs/2.1.0.RELEASE/reference/htmlsingle/#getting-started-system-requirements-servlet-containers不支持Tomcat7


是的,我认为使用 spring boot 配置是最好的选择。 要使用特定的 tomcat 版本,您应该执行以下步骤:

1-确保您的项目有 spring boot<parent>在你的 pom.xml 中:

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
 </parent>

2-添加tomcat.version to <properties>:

<properties>
    ...
    <tomcat.version>8.5.35</tomcat.version>
    ...
</properties>

就是这样,导入新的依赖项,应用程序应该作为嵌入式 Tomcat 运行,并使用您在步骤 2 中指定的版本。

话虽如此,请注意某些 tomcat 版本存在一些问题。我建议您,如果您想使用 8.5.X 版本,请使用我测试过的 8.5.35,它运行得很好。

希望这对您有帮助。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

用于嵌入式 Tomcat 8.5 的 Tomcat Maven 插件 的相关文章

随机推荐