最小化的Spring Security的Gradle配置
dependencies {
compile 'org.springframework.security:spring-security-web:5.0.3.RELEASE'
compile 'org.springframework.security:spring-security-config:5.0.3.RELEASE'
}
所有GA版本都位于Maven Central
repositories {
mavenCentral()
}
如果使用SNAPSHOT版本
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
如果使用milestone或release candidate版本
repositories {
maven { url 'https://repo.spring.io/milestone' }
}
默认,Gradle在解决传递性版本问题时,会使用最新的版本,比如在Spring Framework 5.0.4 .RELEASE运行Spring Security 5.0.3.RELEASE。但有时可能会存在问题,此时可以
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion '5.0.4.RELEASE'
}
}
}