Update POM.xml with necessary Jar Version

Under the project, you can find pom.xml file. Right-click this file, and Open With Text Editor:

 

Adding below dependencies:

<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/maven-v4_0_0.xsd”>

  <modelVersion>4.0.0</modelVersion>

  <groupId>com.itblog</groupId>

  <artifactId>SpringRestfulExample</artifactId>

  <packaging>war</packaging>

  <version>0.0.1-SNAPSHOT</version>

  <name>SpringMVCExample Maven Webapp</name>

  <url>http://maven.apache.org</url>

  <properties>

    <spring.version>4.2.0.RELEASE</spring.version>

    <hibernate.version>4.3.11.Final</hibernate.version>

    <javax.validator.version>1.1.0.Final</javax.validator.version>

    <hibernate.validator.version>5.2.2.Final</hibernate.validator.version>

    <mysql.connector.version>5.1.31</mysql.connector.version>

    <apache.dbcp.version>2.0</apache.dbcp.version>

    <servlet.version>3.1.0</servlet.version>

    <jackson.version>2.6.4</jackson.version>

    <slf4j.version>1.7.13</slf4j.version>

  </properties>

  <dependencies>

    <!– Unit Test –>

    <dependency>

              <groupId>junit</groupId>

              <artifactId>junit</artifactId>

              <version>4.8.2</version>

    </dependency>

    <!– Spring Framework –>

    <dependency>

              <groupId>org.springframework</groupId>

              <artifactId>spring-core</artifactId>

              <version>${spring.version}</version>

              <exclusions>

                     <exclusion>

                           <groupId>commons-logging</groupId>

                           <artifactId>commons-logging</artifactId>

                     </exclusion>

              </exclusions>

       </dependency>

       <dependency>

       <groupId>org.springframework</groupId>

        <artifactId>spring-web</artifactId>

        <version>${spring.version}</version>

       </dependency>

    <dependency>

       <groupId>org.springframework</groupId>

        <artifactId>spring-webmvc</artifactId>

        <version>${spring.version}</version>

    </dependency>

    <dependency>

              <groupId>org.springframework</groupId>

              <artifactId>spring-aop</artifactId>

              <version>${spring.version}</version>

    </dependency>

    <dependency>

       <groupId>org.springframework</groupId>

        <artifactId>spring-orm</artifactId>

        <version>${spring.version}</version>

    </dependency>

    <dependency>

       <groupId>org.springframework</groupId>

        <artifactId>spring-tx</artifactId>

        <version>${spring.version}</version>

    </dependency>

    <!– hibernate –>

    <dependency>

       <groupId>org.hibernate</groupId>

       <artifactId>hibernate-core</artifactId>

       <version>${hibernate.version}</version>

   </dependency>

   <dependency>

       <groupId>org.hibernate</groupId>

       <artifactId>hibernateentitymanager</artifactId>

       <version>${hibernate.version}</version>

   </dependency>

   <!– hibernate validation –>

   <dependency>

       <groupId>javax.validation</groupId>

        <artifactId>validation-api</artifactId>

        <version>${javax.validator.version}</version>

   </dependency>

   <dependency>

       <groupId>org.hibernate</groupId>

        <artifactId>hibernatevalidator</artifactId>

        <version>${hibernate.validator.version}</version>

   </dependency>

    <!– MySQL –>

    <dependency>

       <groupId>mysql</groupId>

       <artifactId>mysql-connector-java</artifactId>

       <version>${mysql.connector.version}</version>

   </dependency>

    <!– Apache Commons DBCP –>

    <dependency>

       <groupId>org.apache.commons</groupId>

       <artifactId>commons-dbcp2</artifactId>

       <version>${apache.dbcp.version}</version>

   </dependency>

   <!– Java Servlet –>

   <dependency>

              <groupId>javax.servlet</groupId>

              <artifactId>javax.servlet-api</artifactId>

              <version>${servlet.version}</version>

   </dependency>

    <!– Response with JSON data format –>

    <dependency>

              <groupId>com.fasterxml.jackson.core</groupId>

             <artifactId>jacksondatabind</artifactId>

             <version>${jackson.version}</version>

    </dependency>

    <!– slf4j with Log4j logger –>

    <dependency>

        <groupId>org.slf4j</groupId>

        <artifactId>slf4j-log4j12</artifactId>

        <version>${slf4j.version}</version>

    </dependency>

  </dependencies>

  <build>

       <pluginManagement>

              <plugins>

             <plugin>

                <groupId>org.apache.maven.plugins</groupId>

        <artifactId>maven-war-plugin</artifactId>

                <version>2.4</version>

                <configuration>

                    <warSourceDirectory>src/main/webapp</warSourceDirectory>

                    <warName>SpringRestfulExample</warName>

                    <failOnMissingWebXml>false</failOnMissingWebXml>

                       </configuration>

</plugin>

              </plugins>

     </pluginManagement>

    <finalName>SpringRestfulExample</finalName>

</build>

</project>

 

Save the pom.xml , and right-click the project => select “Run As” => choose “Maven build…”

Fill in “clean install” as Goals, click “Apply” and then “Run”.

 

Maven will download the necessary JAR libraries, and build the project. Under the Console, it will show you:

 

I can’t find the Console, where is it? You can go to “Window” => select “Show View” => “Console”. Then, Console will be shown at the bottom panel.

 

Where is the Jar files? You can right-click the project => select “Properties” => click “Libraries”. Then, you can see what Jar files have been downloaded, and where they are.

 

Simply updating the pom.xml , all necessary Jar files will be downloaded and stored in a proper location by Maven. You can find the Jar libraries, their version and features below, all of them will be used for our examples.

Jar Libraries Version Details
Junit 4.8.2 For unit testing of your Java classes
Spring-core 4.2.0.RELEASE Spring Core library
Spring-web 4.2.0.RELEASE Spring Web library
Spring-webmvc 4.2.0.RELEASE For Spring web MVC framework
Spring-aop 4.2.0.RELEASE Spring AOP library, using to define <aop:scope-proxy/> for your beans
Spring-orm 4.2.0.RELEASE Spring ORM library. As we are using Hibernate for our example, we need to have this library
Spring-tx 4.2.0.RELEASE Managing database transaction
Hibernate-core 4.3.11.Final Hibernate Core library
Hibernate-entitymanager 4.3.11.Final API accessing to the table, such as finding entities (DB record) by primary key or query, create or delete any entity (DB record)
Validation-api 1.1.0.Final Java bean validation
Hibernate-validator 5.2.2.Final Hibernate validation library
Mysql-connector-java 5.1.31 MySQL JDBC driver
Commons-dbcp2 2.0 JDBC connection pool
Javax.servlet-api 3.1.0 Java Servlet
FasterXML/Jackson 2.6.4 Response with JSON data format
Slf4j-log4j12 1.7.13 For logging

 

Please rate this