Spring Gradle MVC application

Gradle is similar to Maven; it helps in building the applications. We need to provide all the dependency information in the build.gradle file. Spring boot also has a Gradle plugin. The Gradle plugin helps in placing all the dependencies JAR files on the classpath and finally builds into a single runnable JAR file. The runnable JAR file will have an application.java file; this class will have a public static void main() method. This class will be flagged as a runnable class.

A sample Gradle file is shown here:

buildscript { repositories { maven { url "http://repo.spring.io/libs-milestone" } mavenLocal() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.3.RELEASE") } } apply plugin: 'java' ...

Get Mastering Spring Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.