Not able to run the project using tomcat plugin | Spring Boot and MicroServices Forum
R
RamPrakash Kothandaramulu Posted on 17/08/2021

Downloaded the tomcat 10 version and intellij not recognizing the tomcat version. Please help me out


R
RamPrakash Kothandaramulu Replied on 18/08/2021

 

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.test</groupId>
<artifactId>WebProjectWithMavenSpring</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>WebProjectWithMavenSpring Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.19.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.1.19.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.2-b02</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
</dependencies>

<build>
<finalName>WebProjectWithMavenSpring</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat8-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8085</port>
</configuration>
</plugin>


</plugins>
</pluginManagement>
</build>
</project>


Y
Yogesh Chawla Replied on 19/08/2021

Don't use <pluginManagement> in pom.xml and thentry. This plugin locks versions due to which it does not accept any version available on your system/environment.Your build tag will be like this:

Try with this:

<build>
    <finalName>WebProjectWithMavenSpring</finalName>
      <plugins>

        <plugin>
          <artifactId>maven-war-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
       <plugin>
         <groupId>org.apache.tomcat.maven</groupId>
         <artifactId>tomcat8-maven-plugin</artifactId>
         <version>2.2</version>
          <configuration>
            <port>8085</port>
          </configuration>
        </plugin>
      </plugins>
  </build>