![Spring 5.0 Cookbook](https://wfqqreader-1252317822.image.myqcloud.com/cover/699/36700699/b_36700699.jpg)
上QQ阅读APP看书,第一时间看更新
How to do it...
After installing the Gradle STS extension, perform the following steps to install the Spring Gradle project:
- After installing, you are ready to create a Gradle project for Spring development. Go to the New project wizard (Ctrl-N) of STS Eclipse and create a Gradle project.
- On the Gradle Project wizard, assign a name for your project and choose Java Quickstart for the Sample project option. Click Finish and it will take a while to create, build, clean, and install your Gradle STS project.
- Delete unnecessary project files. Right-click on the project and click on Gradle (STS) | Refresh all.
- Open the build.gradle and overwrite the existing configuration with this:
apply plugin: 'eclipse'
apply plugin: "war"
sourceCompatibility = 1.8
version = '1.0'
war {
baseName = 'ch02-gradle'
version = '1.0'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
jcenter()
}
- Right-click on the project and click Gradle (STS) | Tasks Quick Launcher to run the Gradle Task Launcher. Using the launcher, clean and build the project for the first time:
![](https://epubservercos.yuewen.com/0AC9E4/19470403601617006/epubprivate/OEBPS/Images/01f90efe-f279-4b76-a4d5-1ab6ed2a431a.png?sign=1738910594-hn6iKZONRT1Hs8aiSxkzHlLXNU7a827I-0-0561f0de3903bdb853904366ac47ffc9)
- Finally, at this point, you have created your Spring Gradle project which will look like this:
![](https://epubservercos.yuewen.com/0AC9E4/19470403601617006/epubprivate/OEBPS/Images/0ccf8af1-313b-4c29-b945-63df05b2c89d.png?sign=1738910594-lJAmbDLDwmzxuoObU2SKuHKrZXvxIg3Y-0-589fe540b5cd84c4ba2c3712261743ac)