Book Image

Spring MVC Beginner's Guide

By : Amuthan Ganeshan
Book Image

Spring MVC Beginner's Guide

By: Amuthan Ganeshan

Overview of this book

Table of Contents (19 chapters)
Spring MVC Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Gradle build script for your project


To configure the Gradle build script for your project, perform the following steps:

  1. Go to the root directory of your project from the filesystem, create a file called build.gradle, and add the following content into the file and save it:

    apply plugin: 'war'
    apply plugin: 'eclipse-wtp'
    
    repositories {
      mavenCentral() //add central maven repo to your buildfile
    }
      
    dependencies {
      compile 'org.springframework:spring-webmvc:4.0.3.RELEASE', 
      'javax.servlet:jstl:1.2',
      'org.springframework.security:spring-security-web:3.1.4.RELEASE',
      'commons-fileupload:commons-fileupload:1.2.2',
      'org.apache.commons:commons-io:1.3.2',
      'org.springframework:spring-oxm:4.0.3.RELEASE',
      'org.codehaus.jackson:jackson-mapper-asl:1.9.10',
      'log4j:log4j:1.2.12',
      'org.hibernate:hibernate-validator:4.3.1.Final',
      'org.springframework.webflow:spring-webflow:2.3.3.RELEASE',
      'org.apache.tiles:tiles-extras:3.0.3',
      'org.slf4j:slf4j-api:1.7.5'
      
      compile('org.springframework.security:spring-security-config:3.1.4.RELEASE') {
        //excluding a particular transitive dependency:
        exclude group: 'org.springframework', module: 'spring-asm'
      }
      
      providedCompile 'javax.servlet:javax.servlet-api:3.1.0' 
      
      testCompile 'junit:junit:4.11', 
      'org.springframework:spring-test:4.0.3.RELEASE', 
      'com.jayway.jsonpath:json-path-assert:0.8.1'
    }
  2. Now go to the root directory of your project from the command prompt and issue the following command:

    > gradle eclipse
    
  3. Next, open a new workspace in your STS, go to File | Import, select the Existing Projects into Workspace option from the tree list (you can find this option under the General node), and then click on the Next button.

  4. Click on the Browse button to select the root directory and locate your project directory. Click on OK and then on Finish.

Now, you will be able to see your project configured with the right dependencies in your STS.