2013-12-06

Deploying a Gradle webapp project in Spring Tool Suite

There's not a lot of documentation on how to configure a Gradle webapp project to deploy to e.g. tc Server in Spring Tool Suite, but based on a recent Spring forum post, it was easy.
  1. Install the Gradle Integration for Eclipse plugin if you don't have it already. The easiest way to do so is Help > Eclipse Marketplace... then search for Gradle.
  2. Add the following to the end of build.gradle:
    apply plugin: "eclipse-wtp"
    eclipse {
        wtp {
            facet {
                facet name: 'jst.web', version: '2.5'
                facet name: 'java', version: '1.6'
                facet name: 'wst.jsdt.web', version: '1.0'
            }
        }
    }
  3. Run the "eclipse" task as a Gradle Build by right-clicking the project > Run As > Gradle Build...
If it works, you should see the big G overlay in the upper right quadrant of the project icon in the Package Explorer which marks it as a Grade project, and the tiny Earth icon in the upper left quadrant of the project icon which marks it as a dynamic web project.

From there you can simply drag the project onto the server in the Servers view, or double click the server, go to the Modules tab, and add it with the Add Web Module... button.

Further reading:

No comments:

Post a Comment