嵌入式Tomcat 8.5的Tomcat Maven插件 [英] Tomcat Maven Plugin for embedded Tomcat 8.5

查看:767
本文介绍了嵌入式Tomcat 8.5的Tomcat Maven插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Spring Web应用程序,并且无法使用答案这个答案,但对于部署 tomcat来说很好. /p>

我在问题改用spring boot功能,有人可以提供更多详细信息吗?

看来这个项目已经死了,我建议您使用具有类似功能的Spring Boot进行研究: https://spring.io/projects/spring-boot

尤其是当 Spring Boot 2.1 不支持Tomcat7

解决方案

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

1-确保在pom.xml中具有spring boot作为项目<parent>:

 <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添加到<properties>:

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

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

话虽如此,请注意某些tomcat版本存在一些问题.我建议您,如果要使用8.5.X版本,请使用我测试过的8.5.35,它可以正常工作.

希望这对您有所帮助.

I'm running a Spring web application and failing to execute embedded tomcat in latest Eclipse with Tomcat 8.5 using Tomcat 7 Maven Plugin , I'm running tomcat7:run-war goal on windows but failed to configure it to run Tomcat 8.5, it keeps finding tomcat 7 folder.

tomcat7:run-war Runs the current project as a packaged web application using an embedded Tomcat server.

I found answer or this answer but it's good for deploying tomcat .

I found in a deleted link tomcat8 plugin. Is it relevant?

I found issue that suggest use spring boot feature instead, can someone provide more details?

it appears this project is dead, I recommend you look into using Spring Boot which has very similar features: https://spring.io/projects/spring-boot

Especially when Spring Boot 2.1 won't support Tomcat7

解决方案

Yeah, I think that using spring boot configuration is the best option here. To use a specific tomcat version you should do the following steps:

1- Make sure that you have spring boot as the project <parent> in your 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- Add the tomcat.version to <properties>:

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

And that's it, import the new dependencies and the application should run as an embedded Tomcat with the version that you specify in step 2.

Having said that, be aware that there are some issues with certain tomcat versions. I would suggest you that, if you want to use an 8.5.X version, use the 8.5.35 which I tested and it's working perfectly.

Hope this helps you.

这篇关于嵌入式Tomcat 8.5的Tomcat Maven插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆