Search code examples
gradleartifactory

`gradlew eclipse` not pulling specific package


i am upgrading the Spring Boot version for one of the team's smaller projects, & it seems that Gradle is not able to download this specific package org.jfrog.artifactory.client:artifactory-companyName-client-services:2.13.0 from our company's Artifactory website

here is the build.gradle:

buildscript {
   ext {
      springBootVersion = '2.6.9'
   }
   repositories {
      maven {
            url "https://artifactory.trusted.companyName.com/mavenrepo/"
            credentials {
                username = project.artifactory_username
                password = project.artifactory_apikey
            }
        }
   }
   dependencies {
      classpath 'org.ajoberstar:grgit:1.7.2'
      classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
   }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
if (project.hasProperty("projVersion")) {
    version =  project.projVersion
} else {
    version = "0.0-SNAPSHOT"
}

group = 'CoreConfigBackend'

// In this section you declare where to find the dependencies of your project
repositories {
    maven {
            url "https://artifactory.trusted.companyName.com/companyNamecommonssecurity-maven-virtual/"
            credentials {
                username = project.artifactory_username
                password = project.artifactory_apikey
            }
        }
    maven {
            url "https://artifactory.trusted.companyName.com/mavenrepo/"
            credentials {
                username = project.artifactory_username
                password = project.artifactory_apikey
            }
        }
    maven {
            url "https://artifactory.trusted.companyName.com/coreconfig_commons-snapshots/"
            credentials {
                username = project.artifactory_username
                password = project.artifactory_apikey
            }
        }
}

configurations {
    all*.exclude module : 'spring-boot-starter-logging'
}


dependencies {
    
    if (project.hasProperty("local")) {
        compile project(':CommonUtility')
    } else {
        compile(group: 'CoreConfigBackend', name: 'CommonUtility', version: version){ changing = true }
    }
    
    compile('org.springframework.boot:spring-boot-starter-web:2.6.9')
    compile('org.springframework:spring-tx:5.3.22')
    compile 'org.springframework.boot:spring-boot-starter-jdbc:2.6.9'
    compile('com.github.ulisesbocchio:jasypt-spring-boot:2.1.0')

    compile 'org.springframework.boot:spring-boot-starter-data-mongodb:2.6.9'
    
    compile ("commons-lang:commons-lang:2.6")
    compile 'com.fasterxml.jackson.core:jackson-core:2.9.4'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.9.4'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.9.4'
    
    compile 'org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0'

    // Log4j 2
    compile ('org.apache.logging.log4j:log4j-core:2.17.1')
    compile ('org.apache.logging.log4j:log4j-api:2.17.1')
    compile ('org.apache.logging.log4j:log4j-slf4j-impl:2.17.1')
    
    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'
}


bootJar {
    exclude ("application.properties")
    exclude ("database.properties")
    exclude ("artifactory.properties")
}

task setupProject {
  doFirst {
    File dir = new File("$buildDir/../../../coreconfig_commons")
    if(!dir.exists()) {
        def grgit = org.ajoberstar.grgit.Grgit.clone(dir: "$buildDir/../../../companyName_commons", uri: "https://stash.trusted.companyName.com:7990/scm/cor1dca/companyName_commons.git")
    }
  }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}

& the contents of the gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip

i run the command gradlew eclipse -Plocal -Partifactory_username='username' -Partifactory_apikey='password' in the command line to pull the packages.

Oddly, it's only this artifactory-java-client-services package that is missing, not sure why but somehow Gradle can't retrieve this package?

When i import the project into Eclipse, there is an Eclipse Error message saying that the artifactory-java-client-services package is missing.

Even this missing package warning is displayed in the command line after running the gradle command.

i checked our company's Artifactory website & i can see the package listed there

After running the gradlew eclipse -Plocal -Partifactory_username='username' -Partifactory_apikey='password' command in the command line, this is the output:

> Task :eclipseClasspath
Could not resolve: org.jfrog.artifactory.client:artifactory-java-client-services:2.13.0

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 SUCCESSFUL in 33s
10 actionable tasks: 10 executed

This is my gradle version, after running gradlew -v:

gradlew -v

------------------------------------------------------------
Gradle 6.8
------------------------------------------------------------

Build time:   2021-01-08 16:38:46 UTC
Revision:     b7e82460c5373e194fb478a998c4fcfe7da53a7e

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          1.8.0_361 (Oracle Corporation 25.361-b31)
OS:           Windows 10 10.0 amd64

Solution

  • managed to solve it, i had to manually replace the username & password in build.gradle.

    so all instances of

    credentials {
           username = project.artifactory_username
           password = project.artifactory_apikey
    }
    

    had to be replaced with

    credentials {
           username = 'username'
           password = 'password'
    }
    
    

    running gradlew -Plocal -Partifactory_username='username' -Partifactory_apikey='password' doesn't work