How to parse Authentication through login forms with gradle?


(Jerald Sabu) #1

Recently, in our organisation, we have enabled PHP based authentication to access any public website due to some security reasons. so this has affected the artifactory download or upload process using gradle.

Currently I get the following error when trying to setup an application using gradle with PHP based authentication enabled.

jerald@mci:~/repo/TK/tk-baseshop$ gradle setUp
Download http://abcd/artifactory/repo/abc/abcd/6.4.0/abcd-6.4.0.pom
[Fatal Error] abcd-6.4.0.pom:3:10: Already seen doctype.

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘/home/jerald/repo/TK/tk-baseshop/build.gradle’ line: 39
  • What went wrong:
    Could not resolve all dependencies for configuration ‘:abcd’.

Could not resolve abcd:abcd:6.4.0.
Required by:
project :
Could not resolve abcd:abcd:6.4.0.
Could not parse POM http://abcd/artifactory/repo/abc/abcd/6.4.0/abcd-6.4.0.pom
Already seen doctype.

Following is the login prompt which is seen after accessing http://abcd/artifactory/

I was able to build successfully after disabling the PHP authentication.

Note that there is also an authentication defined with maven to upload/download artifacts from repositories.

    maven {
        url "${artifactUrl}/libs-${project.version.endsWith('-SNAPSHOT') ? 'snapshot' : 'release'}-local"

Could anyone help on how to parse this method of authentication in build.gradle file, apart from the authentication with maven. ?