Issue setting up the dependencies in POM file | Spring Boot, Hibernate, MicroServices and Cloud Forum
A
Akash Beniwal Posted on 06/08/2021

Hey Yogesh,

I am getting errors while setting up the dependencies and not able to see Tomcat under maven as you showed us in the session. I am attaching the screenshots for both.

 

Thank you,

Akash


Y
Yogesh Chawla Replied on 06/08/2021

This is the correct pom.xml used by Maven tool for basic Spring MVC Architecture based application.

Please add the dependencies, plugins with the versions as mentioned in this pom.xml and Please enable auto-import in IntelliJ so that these dependencies are automatically updated in your local .m2 directory and your code will further be able to use the APIs belonging to these dependencies.

 

<?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.programming.springExamples</groupId>
    <artifactId>SpringMVCArchitectureWIthMaven</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.9.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>
        <plugins>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <port>6002</port>
                </configuration>
            </plugin>
        </plugins>
    </build>



</project>