使用生成的Gradle.properties时,Gradle Artifactory部署失败
我有以下build.gradle文件:使用生成的Gradle.properties时,Gradle Artifactory部署失败,gradle,artifactory,Gradle,Artifactory,我有以下build.gradle文件: plugins { id 'java-gradle-plugin' id 'com.gradle.plugin-publish' version '0.10.1' id 'groovy' id 'maven-publish' id "com.jfrog.artifactory" version "4.9.1" } group = 'de.gafertp' version = '2.0.0' repositorie
plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.10.1'
id 'groovy'
id 'maven-publish'
id "com.jfrog.artifactory" version "4.9.1"
}
group = 'de.gafertp'
version = '2.0.0'
repositories {
mavenCentral()
}
dependencies {
compile 'net.sourceforge.plantuml:plantuml:1.2019.1'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.4.0'
testCompile 'org.junit-pioneer:junit-pioneer:0.3.0'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.4.0'
}
gradlePlugin {
plugins {
plantUmlPlugin {
id = 'de.gafertp.plantuml'
displayName = 'Gradle PlantUML Plugin'
description = 'A very simple plugin to render PlantUML files. ' +
'Takes a set of diagram files together with desired output files / formats ' +
'and renders them with PlantUML (http://plantuml.com/).'
implementationClass = 'de.gafertp.PlantUmlPlugin'
}
}
}
pluginBundle {
website = 'https://github.com/codecholeric/gradle-plantuml-plugin'
vcsUrl = 'https://github.com/codecholeric/gradle-plantuml-plugin'
tags = ['plantuml']
}
publishing {
publications {
plantUmlPluginJar(MavenPublication) {
from components.java
}
}
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'gradle-dev-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
println "username=${artifactory_user}"
println "password=${artifactory_password}"
maven = true
}
defaults {
publications('plantUmlPluginJar')
}
}
resolve {
repository {
repoKey = 'gradle-dev'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
test {
useJUnitPlatform()
}
这个gradle.properties文件:
artifactory_user=${security.getCurrentUsername()}
artifactory_password=${security.getEncryptedPassword()!"blahblah"}
artifactory_contextUrl=http://localhost:8081/artifactory
生成失败,出现以下错误:
Execution failed for task ':artifactoryDeploy'.
> java.io.IOException: Failed to deploy file. Status code: 401 Response message: Artifactory returned the following errors:
Unauthorized Status code: 401
如果我们查看打印的用户名和密码,我们会看到:
username=${security.getCurrentUsername()}
password=${security.getEncryptedPassword()!"blahblah"}
Gradle将属性值作为文本字符串,而不是计算它们。因此,问题似乎是找不到安全性
对象,因为如果我将build.gradle
文件中的属性直接替换为它们的值,则会发生以下错误:
A problem occurred evaluating root project 'gradle-plantuml-plugin'.
> Could not get unknown property 'security' for object of type org.jfrog.gradle.plugin.artifactory.dsl.DoubleDelegateWrapper.
我做错了什么?使用明文用户名和密码时,部署工作正常,但我希望使用自动生成的登录方式(使用加密密码)。似乎
gradle.properties
应该如下所示:
username=your_username
password=blahblah
我们假设
blahblah
是您的加密密码。它的可能副本不是副本。我使用的是默认拥有所有权限的管理员用户。