7

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

Community
  • 1
  • 1
Ori Marko
  • 56,308
  • 23
  • 131
  • 233

1 Answers1

2

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.

Ariel Kohan
  • 674
  • 4
  • 15
  • 1
    Thank you for answering, Is there a way without spring boot? Also are there issues with tomcat 8.5.23? – Ori Marko Dec 03 '18 at 06:27
  • The `8.5.23` Tomcat version is not working for me when I combine it with the Spring Boot `2.1.1.RELEASE` version. I recommend the spring boot solution but if you want to do it in a non-boot spring way I would recommend you to use this question with the accepted answer: https://stackoverflow.com/questions/45169586/how-do-i-embed-tomcat-in-a-spring-framework-mvc-application Please let me know if it was helpful to you :) – Ariel Kohan Dec 03 '18 at 10:41
  • Did I help you in any way? If so, the bounty would be really appreciated :) – Ariel Kohan Dec 04 '18 at 01:57