Spring security 如何通过Gradle安装snapshot jar?
例如,我想将jar文件安装到本地存储库中。到目前为止,我将Spring security 如何通过Gradle安装snapshot jar?,spring-security,Spring Security,例如,我想将jar文件安装到本地存储库中。到目前为止,我将build.gradle修改为: buildscript { dependencies { classpath 'io.spring.gradle:spring-build-conventions:0.0.33.RELEASE' classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion&
build.gradle
修改为:
buildscript {
dependencies {
classpath 'io.spring.gradle:spring-build-conventions:0.0.33.RELEASE'
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath 'io.spring.nohttp:nohttp-gradle:0.0.5.RELEASE'
}
repositories {
mavenLocal() // 使用本地仓库
maven { url 'https://repo.spring.io/plugins-snapshot' }
maven { url 'https://plugins.gradle.org/m2/' }
}
}
plugins{
id 'maven-publish'
}
apply plugin: 'io.spring.nohttp'
apply plugin: 'locks'
apply plugin: 'io.spring.convention.root'
apply plugin: 'maven'
group = 'org.springframework.security.experimental'
description = 'Spring Authorization Server'
ext.snapshotBuild = version.contains("SNAPSHOT")
repositories {
mavenLocal() // 使用本地仓库
mavenCentral()
}
// 指定上传的路径
def localMavenRepo = 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath
// 上传Task,Gradle会生成并上传pom.xml文件。
uploadArchives {
repositories {
mavenDeployer {
repository(url: localMavenRepo)
//构造项目的Pom文件
pom.project {
name = project.name
packaging = 'jar'
description = 'description'
}
}
}
}
publishing {
// 配置发布的地址
repositories{
// 一. 这种方式是最简便的方式
mavenLocal()
}
}
dependencyManagementExport.projects = subprojects.findAll { !it.name.contains('-boot') }
subprojects {
plugins.withType(JavaPlugin) {
project.sourceCompatibility = "1.8"
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
}
nohttp {
allowlistFile = project.file("etc/nohttp/allowlist.lines")
}
运行gradle uploadArchives
时,我收到了以下错误:
Execution failed for task ':spring-security-oauth2-authorization-server:uploadArchives'.
Could not publish configuration 'archives'
Must specify a repository for deployment
Execution failed for task ':artifactoryDeploy'.
java.io.IOException: Failed to deploy file. Status code: 401 Response message: Artifactory returned the following errors:
Artifactory configured to accept only encrypted passwords but received a clear text password, getting the encrypted password can be done via the WebUI. Status code: 401
另外,在运行artifactory publishing
时,我收到了以下错误:
Execution failed for task ':spring-security-oauth2-authorization-server:uploadArchives'.
Could not publish configuration 'archives'
Must specify a repository for deployment
Execution failed for task ':artifactoryDeploy'.
java.io.IOException: Failed to deploy file. Status code: 401 Response message: Artifactory returned the following errors:
Artifactory configured to accept only encrypted passwords but received a clear text password, getting the encrypted password can be done via the WebUI. Status code: 401
有什么想法吗?安装任务将把工件部署到Maven存储库,包括本地存储库。有关详细信息,请参阅 如果要引用Spring Authorization Server的快照jar,请确保gradle构建文件中包含以下内容:
dependencies {
compile 'org.springframework.security.experimental:spring-security-oauth2-authorization-server:0.1.0-SNAPSHOT'
}
repositories {
maven { url 'https://repo.spring.io/snapshot' }
}
有关更多详细信息,请参阅的Spring安全参考