Deploying to the Java EE application server

To deploy your Spring application to one of the mainstream Java EE application servers, you will need to make a couple of changes in your code, and then your project will be ready. We need a WAR build instead of the JAR for this.

Open build.gradle and update it so that the Gradle WAR plugin is applied:

buildscript { ext { kotlinVersion = '1.2.21' springBootVersion = '2.0.0.M4' } repositories { mavenCentral() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}") ...

Get Building Applications with Spring 5 and Kotlin 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.