Gradle.properties is not being read

I have recently moved to a new laptop and is facing issue with setting up gradle 7.6.4 on intellij. I had no issues with the setup in my old laptop. I have gradle.properties file in C:\Users\username\ .gradle with artifactory_user=user
artifactory_password=pass
artifactory_contextUrl=url
From intellij when i import an existing gradle project it gives me error ,
Could not get unknown property ‘artifactoryUser’ for settings ‘projectname’ of type org.gradle.initialization.DefaultSettings.

I tried hardcoding the username and password. Then it fails in the first line of build.gradle where it is unable to download plugin. I believe something is wrong with the initialization of gradle. I am using correct java version. I tried accessing properties and it returns null
println(settings.hasProperty(‘artifactory_password’) ? settings.artifactory_password : ‘’)
println(hasProperty(‘artifactory_user’) ? artifactory_user : ‘’)

Please compare the spelling of the property names in C:\Users\username\ .gradle\gradle.properties with your settings.gradle.

In the gradle.properties you use snake case, e.g. artifactory_user. From the error message it seems you are using camel case in your settings file:

[…] unknown property ‘artifactoryUser’ […]

Apologies for the confusion. I am using same names at the same time. I just tried both camel and snake case. When i copied the error it happened to not match. I still have same issue even with same property name.