Gradle not able to download dependencies from artifactory

0

I am having spring boot(2.19.RELEASE) gradle project…but its not able download the first dependencies (oa-common.3.0.0.jar) It looks like its not going to artifactory to fetch it…even though its mentioned in the repositories…what I am doing wrong…any suggestion?

My build.gradle file

repositories {
    mavenCentral()
    mavenLocal()
    maven {
        url "${artifactory_contextUrl}"
        credentials {
            username "${artifactory_user}"
            password "${artifactory_password}"
        }
    }
}

wrapper {
    distributionType = Wrapper.DistributionType.BIN
}

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
    compileOnly {
        extendsFrom annotationProcessor
    }
}

dependencies {

    implementation('com.ge.digital.oa.common:oa-common:3.0.0') { 
        exclude module: 'slf4j-log4j12'
        exclude group: 'io.micrometer', module: 'micrometer-core'
    }
    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    implementation('org.springframework.boot:spring-boot-starter-jdbc')
    implementation('org.springframework.boot:spring-boot-starter-web')

We have the artifacory jar My Artifactory path:

ARJLY
 com/ge
  digital/oa
   common
     oa-common
      3.0.0
       oa-common-3.0.0.jar

Error:

$ gradle clean build --refresh-dependencies
> Task :compileJava FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com.ge.digital.oa.common:oa-common:3.0.0.
     Required by:
         project :

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 18s
3 actionable tasks: 3 executed

Can you provide a build --scan or at least the --stracktrace output?

https://scans.gradle.com/s/63cvtrwi7ufj2

Are you sure that artifact is available at that repository an with the credentials you used?
According to the scan the repository is there and also is used for compileClasspath.
And is there also a pom file, or just the jar?
By default pom-less artifacts are not found iirc.

just the jar…I can download the jar via the browser by giving url…what is iirc?

iirc = if I remember correctly.

Yeah, that’s the reason then, it cannot find the pure jar with that configuration.
Here you find more information how you configure the metadata sources for that repository: Declaring repositories

Thanks…now the jar is getting downloaded…but in a different folder structure…so my build is still failing…I was forced to put the jar in the artifactory manually… as I was getting this error while pushing the jar in the artifactory -Build Scan® | Gradle Cloud Services now …do you know what I am doing wrong

The artifactory plugin you use in that build uses Gradle internals and is not compatible with the Gradle version you are using.

Btw. you should also not use the Spring Dependency Management plugin. It is an obsolete relict from times when Gradle did not have built-in BOM support which by now does more harm than good. Even its maintainer recommend not to use it anymore.

Thank you very much!!! for all the help and guidance…I am able to build :slight_smile:

1 Like