STS是Spring官方提供的一个基于eclipse的集成开发环境,它内置了Maven、Gradle等Spring依赖的组件,使用STS,用户只需要安装配置好Java环境即可。
- 下载STS3
下载页面:https://spring.io/tools3/sts/all,我们选择windows 64位平台的zip包,具体下载地址为:https://download.springsource.com/release/STS/3.9.11.RELEASE/dist/e4.14/spring-tool-suite-3.9.11.RELEASE-e4.14.0-win32-x86_64.zip - 解压缩
将下载的zip文件解压缩到本地硬盘,这里我们选择放在 C:\GreenSoftware\目录。 - 运行
运行C:\GreenSoftware\sts-bundle\sts-3.9.11.RELEASE\STS.exe,首次运行需要设置开发项目的存放位置,可根据自己的情况设置。 - 设置Maven
STS内置maven,内置maven缺省使用国外的仓库服务器,国内连接很慢,需要更改设置使其使用国内阿里云的仓库服务器。此外,内置的maven缺省使用 ${user.home}/.m2/repository作为本地仓库,我们也顺便将其更改到C:\GreenSoftware\sts-bundle\sts-3.9.11.RELEASE\mvn-respository。为此 首先在C:\GreenSoftware\sts-bundle\sts-3.9.11.RELEASE\configuration目录下创建“MvnSettings.xml”,其内容如下:<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository> C:\GreenSoftware\sts-bundle\sts-3.9.11.RELEASE\mvn-respository</localRepository> <pluginGroups> </pluginGroups> <proxies> </proxies> <servers> </servers> <mirrors> <mirror> <id>nexus-aliyun</id> <mirrorOf>central</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> </mirrors> <profiles> </profiles> </settings>
然后,打开STS,依次打开以下菜单:Window -> Preferences -> Maven -> User settings
将Global Settings设置为刚才的MvnSettings.xml,然后点击"Apply and Close"按钮完成设置。 -
为了方面使用,可以在桌面上为C:\GreenSoftware\sts-bundle\sts-3.9.11.RELEASE\STS.exe设置一个快捷方式。