【发布时间】:2021-07-13 10:56:43
【问题描述】:
注意:我已经阅读了所有主题都出现相同错误,但没有找到解决方法
我已经在我的 Windows PC 上本地安装了 gradle,我尝试运行执行 gradle clean 命令
C:\work\onsolve\acadia>gradle clean
Starting a Gradle Daemon (subsequent builds will be faster)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\work\****\build.gradle' line: 7
* What went wrong:
A problem occurred evaluating root project 'a****a'.
> Could not get unknown property 'prop1' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
但如果我将gradle.properties 从 GRADLE_USER_HOME(C:\Users***.gradle) 复制到项目文件夹 - 错误就会消失。
来自 cmd 的一些附加信息:
C:\work\onsolve\acadia>gradle -v
------------------------------------------------------------
Gradle 6.9
------------------------------------------------------------
Build time: 2021-05-07 07:28:53 UTC
Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e
Kotlin: 1.4.20
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_291 (Oracle Corporation 25.291-b10)
OS: Windows 10 10.0 amd64
C:\work\***\***>set GRADLE_USER_HOME
GRADLE_USER_HOME=C:\Users\***\.gradle
我错过了什么?
附言
来自 build.gradle 的
sn-p:
buildscript {
repositories {
mavenCentral()
maven {
url "https://artifactory.***.****.com/artifactory/maven"
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
...
gradle.properties:
org.gradle.daemon=false
artifactory_user=****
artifactory_password=****
【问题讨论】:
-
您能否添加您如何阅读该 prop1 的 sn-p,例如 -> discuss.gradle.org/t/read-a-property-from-gradle-properties/…
-
你在哪里使用 gradle?android 项目?
-
@Gabriel Aguiar - 遗留 java spring 项目
-
@gstackoverflow 告诉我 gradle.properties
-
@Gabriel Aguiar 请阅读主题更新
标签: java spring gradle gradle.properties