How to download/consume published artifacts using gradle

I am trying to publish artifacts to private-GitLab with two dependencies(Web and Actuator) as below

dependencies {
    compile("org.springframework.boot:spring-boot-starter-actuator")
    compile("org.springframework.boot:spring-boot-starter-web")

}
repositories {
    maven {
        url "https://<gitlab-url>/repo"
        name "GitLab"
        credentials(HttpHeaderCredentials) {
            name = 'Private-Token'
            value = gitLabPrivateToken
        }
        authentication {
            header(HttpHeaderAuthentication)
        }
    }
}

But not sure I am facing 401 error. I replaced git URL with local directory and it got succeeded. I can see metadata and pom files generated. When consuming the artifacts from local directory in another project using below build.gradle

buildscript {
    repositories {
        mavenCentral()
         maven {
            url "C://<location>//gradle-test"
        }
    }
    dependencies {
        classpath("com.gradle:gradleproject:0.0.1-SNAPSHOT")
    }
}

I am facing the below error.

C:\Users\root\gradle>gradle build

> Task :buildEnvironment

------------------------------------------------------------
Root project
------------------------------------------------------------

classpath
\--- com.gradle:gradleproject:0.0.1-SNAPSHOT
     +--- org.springframework.boot:spring-boot-starter-actuator:2.3.0.RELEASE
     |    +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE
     |    |    +--- org.springframework.boot:spring-boot:2.3.0.RELEASE
     |    |    |    +--- org.springframework:spring-core:5.2.6.RELEASE
     |    |    |    |    \--- org.springframework:spring-jcl:5.2.6.RELEASE
     |    |    |    \--- org.springframework:spring-context:5.2.6.RELEASE
     |    |    |         +--- org.springframework:spring-aop:5.2.6.RELEASE
     |    |    |         |    +--- org.springframework:spring-beans:5.2.6.RELEASE
     |    |    |         |    |    \--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    |         |    \--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    |         +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
     |    |    |         +--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    |         \--- org.springframework:spring-expression:5.2.6.RELEASE
     |    |    |              \--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE
     |    |    |    \--- org.springframework.boot:spring-boot:2.3.0.RELEASE (*)
     |    |    +--- org.springframework.boot:spring-boot-starter-logging:2.3.0.RELEASE
     |    |    |    +--- ch.qos.logback:logback-classic:1.2.3
     |    |    |    |    +--- ch.qos.logback:logback-core:1.2.3
     |    |    |    |    \--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
     |    |    |    +--- org.apache.logging.log4j:log4j-to-slf4j:2.13.2
     |    |    |    |    +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.30
     |    |    |    |    \--- org.apache.logging.log4j:log4j-api:2.13.2
     |    |    |    \--- org.slf4j:jul-to-slf4j:1.7.30
     |    |    |         \--- org.slf4j:slf4j-api:1.7.30
     |    |    +--- jakarta.annotation:jakarta.annotation-api:1.3.5
     |    |    +--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    \--- org.yaml:snakeyaml:1.26
     |    +--- org.springframework.boot:spring-boot-actuator-autoconfigure:2.3.0.RELEASE
     |    |    +--- org.springframework.boot:spring-boot-actuator:2.3.0.RELEASE
     |    |    |    \--- org.springframework.boot:spring-boot:2.3.0.RELEASE (*)
     |    |    +--- org.springframework.boot:spring-boot:2.3.0.RELEASE (*)
     |    |    +--- org.springframework.boot:spring-boot-autoconfigure:2.3.0.RELEASE (*)
     |    |    +--- com.fasterxml.jackson.core:jackson-databind:2.11.0
     |    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
     |    |    |    \--- com.fasterxml.jackson.core:jackson-core:2.11.0
     |    |    +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0
     |    |    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.11.0
     |    |    |    +--- com.fasterxml.jackson.core:jackson-core:2.11.0
     |    |    |    \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
     |    |    +--- org.springframework:spring-core:5.2.6.RELEASE (*)
     |    |    \--- org.springframework:spring-context:5.2.6.RELEASE (*)
     |    \--- io.micrometer:micrometer-core:1.5.1
     |         +--- org.hdrhistogram:HdrHistogram:2.1.12
     |         \--- org.latencyutils:LatencyUtils:2.0.3
     \--- org.springframework.boot:spring-boot-starter-web:2.3.0.RELEASE
          +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
          +--- org.springframework.boot:spring-boot-starter-json:2.3.0.RELEASE
          |    +--- org.springframework.boot:spring-boot-starter:2.3.0.RELEASE (*)
          |    +--- org.springframework:spring-web:5.2.6.RELEASE
          |    |    +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
          |    |    \--- org.springframework:spring-core:5.2.6.RELEASE (*)
          |    +--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
          |    +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0
          |    |    +--- com.fasterxml.jackson.core:jackson-core:2.11.0
          |    |    \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
          |    +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.11.0 (*)
          |    \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.11.0
          |         +--- com.fasterxml.jackson.core:jackson-core:2.11.0
          |         \--- com.fasterxml.jackson.core:jackson-databind:2.11.0 (*)
          +--- org.springframework.boot:spring-boot-starter-tomcat:2.3.0.RELEASE
          |    +--- jakarta.annotation:jakarta.annotation-api:1.3.5
          |    +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35
          |    +--- org.glassfish:jakarta.el:3.0.3
          |    \--- org.apache.tomcat.embed:tomcat-embed-websocket:9.0.35
          |         \--- org.apache.tomcat.embed:tomcat-embed-core:9.0.35
          +--- org.springframework:spring-web:5.2.6.RELEASE (*)
          \--- org.springframework:spring-webmvc:5.2.6.RELEASE
               +--- org.springframework:spring-aop:5.2.6.RELEASE (*)
               +--- org.springframework:spring-beans:5.2.6.RELEASE (*)
               +--- org.springframework:spring-context:5.2.6.RELEASE (*)
               +--- org.springframework:spring-core:5.2.6.RELEASE (*)
               +--- org.springframework:spring-expression:5.2.6.RELEASE (*)
               \--- org.springframework:spring-web:5.2.6.RELEASE (*)

(*) - dependencies omitted (listed previously)

Can Someone help me where I made a mistake or how to resolve this error? and Is this right way to consume the artifacts from local/git?