Unable to find certain transitive dependencies while attempting to upgrade to Gradle 8.13 - Stack Overflow

admin2025-04-19  0

I'm attempting to update a SpringBoot project to use Gradle 8.13 (from 5.6). However I'm running into issue because the build seems to have trouble finding two transitive dependencies required by a couple internally generated jars that are retrieved in our Artifactory server. I confirmed that both jars (castor-commons and object-explorer) are in Artifactory, so I'm not exactly sure what I'm missing or where to go from here. Any advice would be much appreciated!

Errors from Gradle terminal

Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
> Could not find .castor:castor-commons:1.0.5.
Required by:
root project : > com.mydomain:mydomain-commons:2.0.10
> Could not find com.google:object-explorer:20140102.
Required by:
root project : > com.mydomain:mydomain-commons:2.0.10

Possible solution:
 - Declare repository providing the artifact, see the documentation at .html

gradle-wrapper.properties:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

build.gradle

plugins {
    id 'java'
    id '.springframework.boot' version '3.4.3'
    id 'io.spring.dependency-management' version '1.1.7'
}

group = 'com.mydomain'
version = '0.0.1-SNAPSHOT'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(17)
    }
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

repositories {
    mavenLocal()
    maven {
        name = "myReleaseRepo"
        url = ";}
    maven {
        name = "mySnapshotRepo"
        url = "; }
    mavenCentral()
}

dependencies {
    implementation '.mydomain.ods.data:policy-ods-data-commons:1.3.2'
    implementation '.springframework.boot:spring-boot-starter-data-jpa'
    implementation '.springframework.boot:spring-boot-starter-web'
    implementation 'com.mydomain:mydomain-commons:2.0.10'
    implementation 'com.mydomainmons:mydomain-commons-security:2.0.0'

    compileOnly '.projectlombok:lombok'

    annotationProcessor '.projectlombok:lombok'

    testImplementation '.springframework.boot:spring-boot-starter-test'
    testRuntimeOnly '.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
    useJUnitPlatform()
}

Additional logging from console

2025-03-05T17:05:38.033-0600 [DEBUG] [.gradle.api.internal.artifacts.ivyservice.ivyresolve.RepositoryChainComponentMetaDataResolver] Attempting to resolve component for .castor:castor-commons:1.0.5 using repositories [MavenLocal, myReleaseRepo, mySnapshotRepo, MavenRepo]
2025-03-05T17:05:38.033-0600 [DEBUG] [.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module '.castor:castor-commons:1.0.5' in resolver cache 'MavenLocal'
2025-03-05T17:05:38.033-0600 [DEBUG] [.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module '.castor:castor-commons:1.0.5' in resolver cache 'myReleaseRepo'
2025-03-05T17:05:38.033-0600 [DEBUG] [.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module '.castor:castor-commons:1.0.5' in resolver cache 'mySnapshotRepo'
2025-03-05T17:05:38.033-0600 [DEBUG] [.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Detected non-existence of module '.castor:castor-commons:1.0.5' in resolver cache 'MavenRepo'

Update

I was able to get around this issue by excluding those two jars from the two dependencies that were bringing them along. Fortunately I don't believe that they're actually needed any more and were just left behind from old legacy code that has since been removed or refactored. I need to do some regression testing though.

implementation ('com.mydomain:mydomain-commons:2.0.10') {
    exclude group: '.castor', module: 'castor-commons'
    exclude group: 'com.google', module: 'object-explorer'
}
implementation ('com.mydomainmons:mydomain-commons-security:2.0.0') {
    exclude group: '.castor', module: 'castor-commons'
    exclude group: 'com.google', module: 'object-explorer'
}

I am still curious what the core issue was and how I could get around it if I actually need to keep those jars in my build?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745002630a279323.html

最新回复(0)