Gradle 7.1 fails to download artifacts

Gradle 7.1 fails to download artifact from artifactory. I have tried the below with Gradle 6.5.1, 6.7.1 and same error. Any idea what could be the issue?

Error:

Failed to get resource: GET. [HTTP HTTP/1.1 401 Unauthorized: https://www.artifactrepository.xxx.net/artifactory/maven-cto-dev/junit/junit/4.13/junit-4.13.pom]

build.gradle:

repositories {
maven {
url “https://www.artifactrepository.xxx.net/artifactory/maven-cto-dev/
credentials {
username = “name”
password = “pass”
}
}
}

gradle.properties:
name=abc
pass=www

Kind Regards,
Abhijit

If that is really what you used, you used name and pass literally and with that the authentication fails of course.

Thanks for the quick reply. I am new to the programming and Gradle. Could you let me know what change I would need to fix this issue? Appreciate your help in advance.

Remove the quotes around them.
You don’t want Strings, you want the values of the properties.

Or you have to use it as “$name” or “${name}” and “$pass” or “${pass}”, so gradle resolve the variable value in the string.

Thanks for the reply. I have used “${name}” syntax however it is failing with the following error:

C:\Projects\samplegradle>gradle build
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Could not write standard input to Gradle Test Executor 1.
java.io.IOException: The pipe is being closed
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(FileOutputStream.java:326)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.forwardContent(ExecOutputHandleRunner.java:68)
at org.gradle.process.internal.streams.ExecOutputHandleRunner.run(ExecOutputHandleRunner.java:53)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)

Task :test FAILED
Error occurred during initialization of VM
java.lang.InternalError: Could not create SecurityManager: worker.org.gradle.process.internal.worker.child.BootstrapSecurityManager
at sun.misc.Launcher.(Launcher.java:103)
at sun.misc.Launcher.(Launcher.java:54)
at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1444)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1429)

Hard to guess without seeing your build scripts, but does not sound related to your initial question