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' apply plugin: 'war' apply plugin: 'spring-boot' jar { baseName = PacktSpringBootMVCDemo ' version = '1.0' } repositories { mavenCentral() maven { url "http://repo.spring.io/libs-milestone" } ...