build.gradle file does not find a property from the gradle.properties file

1.6k views Asked by At

In my build.gradle file, I have a reference to a property that is in the gradle.properties file:

    credentials {
        username "$USERNAME"
        password "$PASSWORD"
    }

And in the gradle.properties file:

USERNAME=BLAH
PASSWORD=BLAHBLAH

In Intellij, I have an error:

A problem occurred evaluating root project 'my-Project'. Could not get unknown property 'USERNAME' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.

I doubled check the name of the property + restarted the computer + invalidated the cache in the Intellj, but nothing seems to help

1

There are 1 answers

0
riorio On

So after looking in the Intellij's

File -> Setttings -> Build Execution -> Build Tools -> Gradle -> "Gradle User Home"

I realized the Intellij is looking at another gradle.properties file:

C:\Users\<user-X>\.gradle <-- I was focusing on this folder
C:\Users\<user-Y>\.gradle <-- while Intellij was looking at that folder