2

注意:我已经阅读了所有具有相同错误的主题,但没有找到解决方法

我已经在我的 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.propertiesGRADLE_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的片段:

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=****
4

1 回答 1

0

构建.gradle.kts

repositories {
    maven("url") {
        credentials {
            username = rootProject.properties["user"].toString()
            password = rootProject.properties["password"].toString()
        }
    }
    maven("url2")
    mavenLocal()
}
于 2021-07-13T12:12:14.140 回答