Spring 3 part 1: Getting started with maven 3

This is the 1st part of the Spring 3 Series. I know most of you know how to create spring project from maven. This blog I write as a part of the completion of series of my blogs on Spring 3. The my way of creating spring project is, first creating a simple java project and enhanced it up to the Spring project as I want.
image
As shown above figure, the maven command will create first-tut project underneath the maven-projects directory.
image
Now you are ready to import existing maven project to STS. I you are typical Eclipse user, then you can use mvn eclipse:eclipse before import. And you need to create global variable M2_REPO in the Eclipse. In STS there is m2Eclipse integration, therefore you can directly import as shown in the following figure
image
Via STS, you can add spring dependencies as shown in the following
image
You can find the following dependencies just typing “org.spring”.
image
This will update the pom.xml file as follows.
 <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>au.com.blogspot.ojitha.spring3.tut1</groupid>  
  <artifactid>first-tut</artifactid>  
  <version>1.0-SNAPSHOT</version>  
  <packaging>jar</packaging>  

  <name>first-tut</name>  
  <url>http://maven.apache.org</url>  

  <properties>  
    <project.build.sourceencoding>UTF-8</project.build.sourceencoding>  
  </properties>  

  <dependencies>  
    <dependency>  
      <groupid>junit</groupid>  
      <artifactid>junit</artifactid>  
      <version>3.8.1</version>  
      <scope>test</scope>  
    </dependency>  
    <dependency>  
        <groupid>org.springframework</groupid>  
        <artifactid>spring-core</artifactid>  
        <version>3.0.5.RELEASE</version>  
    </dependency>  
  </dependencies></project>  
This is the first blog of Spring 3 series. In the part 2, I would like to discuss the Spring auto wiring.
Written with StackEdit.

Comments

Popular posts from this blog

How To: GitHub projects in Spring Tool Suite

Spring 3 Part 7: Spring with Databases

Parse the namespace based XML using Python