Quantcast
Channel: Crunchify
Viewing all articles
Browse latest Browse all 1037

How to import all Spring MVC Dependencies to your Maven Project?

$
0
0

Spring MVC Basic Maven Dependencies - Crunchify Tips

Are you starting with your first Spring MVC example and wondering how to include all Spring MVC dependencies into your project?

Sometime back I’ve written a complete article on HelloWorld Spring MVC tutorial. It is THE complete Java tutorial available for you to use. While working with some of my friends and users, I came to know that it would be also handy to identify how many Spring MVC .jar files do they have to import into project? In other words, how many maven dependencies if it’s maven project.

Let’s get started:

Step-1

In Eclipse, click on

  1. File
  2. New
  3. Maven Project

Start Creating new Maven Project inside Eclipse

Step-2

Choose default Workspace location

New Maven Project - Use Default Workspace Location

Step-3

  • Select Group Id: org.apache.maven.archetypes.

select org.apache.maven.archetypes

Step-4

  • Provide Group Id: crunchify.com
  • Provide Artifact Id: CrunchifyFirstSpringMvcExample
  • Click on Finish

Group ID and Artifact ID for Maven Project

Step-5

You should see your maven project into Eclipse now.

First Sample Maven Project

Step-6

As maven project comes with default junit dependency you just have to include Spring MVC related dependencies. Open pom.xml file and add below dependencies.

<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>

		<!-- spring-context which provides core functionality -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>4.1.6.RELEASE</version>
		</dependency>

		<!-- The spring-aop module provides an AOP Alliance-compliant aspect-oriented 
			programming implementation allowing you to define -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>4.1.6.RELEASE</version>
		</dependency>

		<!-- The spring-webmvc module (also known as the Web-Servlet module) contains 
			Spring’s model-view-controller (MVC) and REST Web Services implementation 
			for web applications -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.1.6.RELEASE</version>
		</dependency>

		<!-- The spring-web module provides basic web-oriented integration features 
			such as multipart file upload functionality and the initialization of the 
			IoC container using Servlet listeners and a web-oriented application context -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-web</artifactId>
			<version>4.1.6.RELEASE</version>
		</dependency>
	</dependencies>

Now you are all set with your first Spring MVC project.

Have anything to add to this article? Please chime in and join the conversion.


The post How to import all Spring MVC Dependencies to your Maven Project? appeared first on Crunchify.
Author: App Shah


Viewing all articles
Browse latest Browse all 1037

Latest Images

Trending Articles



Latest Images