当前位置: 首页 > 知识库问答 >
问题:

gradle 6.0版本中未解析带有文件分隔符的依赖项

高锦
2023-03-14

我正在升级我的Spring启动项目到gradle 6.0。升级到gradle 6.0以下后,依赖性无法解决。Gradle 6.0处理文件分隔符有什么变化吗?以下是细节。

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#distributionUrl=http://repository.zoom.com:8081/artifactory/gradle-distributions/gradle-4.10.3-bin.zip
distributionUrl=http://repository.zoom.com:8081/artifactory/gradle-distributions/gradle-6.0-bin.zip

依赖关系。格拉德尔

configurations {
    all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
}

      
repositories {
    maven { url 'http://repository.zoom.com:8081/artifactory/prerelease' }
    maven { url 'http://repository.zoom.com:8081/artifactory/public' }
}


dependencies {
    implementation("org.springframework.boot:spring-boot-starter-actuator")
    implementation("org.springframework.boot:spring-boot-starter-amqp")
    implementation('com/zoom/ans:complete-order:dmz.100')
    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

格拉德尔。性质

group=com.zoom.order
projectVersion=1

# Dependencies
springBootVersion=2.1.3.RELEASE
springBootGradlePluginVersion=2.1.3.RELEASE

建筑格拉德尔

buildscript {
    repositories {
        maven { url "http://repository.zoom.com:8081/artifactory/internal-artifacts" }
        maven { url "http://repository.zoom.com:8081/artifactory/plugins-release" }
        maven { url "http://repository.zoom.com:8081/artifactory/public" }
    }
    
    dependencies {
        classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootGradlePluginVersion}"
        
    }
}

// Community Plugins
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'



version = projectVersion + '.' + version;

// Project plugins
apply from: "${projectDir}/gradle/dependencies.gradle"

// Spring Boot Properties
bootRun {
    systemProperties = [ 'spring.config.location' : "file:src/main/config/runtime/local/", 'ExstreamPass_ExitCodeThreshold':8,
        'logging.config' : "$projectDir/src/main/config/runtime/local/log4j2.json",
        'LOG_PATH' : 'C:/logs' ]
   jvmArgs = [ "-Dlogging.config=$projectDir/src/main/config/runtime/local/log4j2.json" ]
}

task qualify(dependsOn: [check, test]) {
    doLast{ println project.name + ' : qualified' }
}

下面是grale构建异常

* What went wrong:
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not find com/zoom/ans:complete-order:dmz.100.
     Required by:
         project :

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

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileJava'.
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:38)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:374)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:361)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:354)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:340)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':compileClasspath'.
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1293)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$2300(DefaultConfiguration.java:140)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitFiles(DefaultConfiguration.java:1270)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.visitStructure(DefaultConfiguration.java:1263)
        at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.visitStructure(DefaultConfiguration.java:504)
        at org.gradle.api.internal.file.CompositeFileCollection.visitStructure(CompositeFileCollection.java:181)
        at org.gradle.internal.fingerprint.impl.DefaultFileCollectionSnapshotter.snapshot(DefaultFileCollectionSnapshotter.java:49)
        at org.gradle.internal.fingerprint.impl.AbstractFileCollectionFingerprinter.fingerprint(AbstractFileCollectionFingerprinter.java:46)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.lambda$visitInputFileProperties$1(ExecuteActionsTaskExecuter.java:306)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$fingerprintInputFiles$3(CaptureStateBeforeExecutionStep.java:192)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.visitInputFileProperties(ExecuteActionsTaskExecuter.java:304)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.fingerprintInputFiles(CaptureStateBeforeExecutionStep.java:188)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionState(CaptureStateBeforeExecutionStep.java:150)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$captureExecutionStateOp$1(CaptureStateBeforeExecutionStep.java:104)
        at org.gradle.internal.execution.steps.BuildOperationStep$1.call(BuildOperationStep.java:40)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
        at org.gradle.internal.execution.steps.BuildOperationStep.operation(BuildOperationStep.java:37)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.captureExecutionStateOp(CaptureStateBeforeExecutionStep.java:103)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.lambda$execute$0(CaptureStateBeforeExecutionStep.java:78)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
        at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
        at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
        at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
        at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
        at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
        at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:174)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:166)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        ... 23 more
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find com/zoom/ans:complete-order:dmz.100.
Required by:
project :

下面是依赖项库项目配置的详细信息。下面一个是将jar(完整订单:dmz.100)发布到存储库。

建筑格拉德尔

buildscript {
    repositories {  
        mavenCentral()
        maven { url 'http://repository.zoom.com:8081/artifactory/maven' }
        maven { url 'http://repository.zoom.com:8081/artifactory/plugins-release' }
    }
    dependencies {
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
        classpath('se.transmode.gradle:gradle-docker:1.2')
        classpath 'com.zoom.ebe:internal-artifacts:+'
        classpath 'com.zoom.ebe:jar-stamper:+'
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea' 
apply plugin: 'docker'
apply plugin: 'maven-publish'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'org.sonarqube'
apply plugin: 'build-dashboard'
apply plugin: 'project-report'
apply plugin: 'checkstyle'
apply plugin: 'com.zoom.ebe.jar-stamper'
apply plugin: 'com.zoom.ebe.internal-artifacts'
apply plugin: 'groovy'

def currentJvm = org.gradle.internal.jvm.Jvm.current()
println currentJvm

sourceCompatibility = 1.8
targetCompatibility = 1.8



project.ext {
    app_name='ANS'
    build_date=new Date().format("yyyyMMddHHmm")
    release_number='R1.0'
    groupId="com.zoom.ans"
    rc_build="${System.env.BUILD_NUMBER}" //look for BUILD_NUMBER in env (set by Jenkins)
    buildID = "ANS_CompleteOrder_Full"
    
    fortify_build_id='ANS_CompleteOrder_Full'
    sonar_projectkey='ANS_CompleteOrder'
    sonar_projectname='ANS Complete Order'
}


group 'com.zoom.ans'



repositories {
    mavenCentral()
    
    maven { url 'http://repository.zoom.com:8081/artifactory/internal-artifacts' } // this repository is designed for internal-artifacts publishing
    maven { url 'http://repository.zoom.com:8081/artifactory/zoom-local' }
    maven { url 'http://repository.zoom.com:8081/artifactory/prerelease' }
    maven { url 'http://repository.zoom.com:8081/artifactory/external' }
    maven { url 'http://repository.zoom.com:8081/artifactory/maven' }
    ivy {
        url 'http://repository.zoom.com:8081/artifactory/maven'
        layout "pattern", {
            artifact "[organisation]/[module]/[revision]/[type]/[artifact]-[revision](-[classifier]).[ext]"
            ivy "[organisation]/[module]/[revision]/ivy-[revision](-[classifier]).xml"
        }
    }
}

task buildDocker(type: Docker, dependsOn: build) {
    push = false
    applicationName = jar.baseName
    dockerfile = file('src/main/docker/Dockerfile')
    doFirst {
        copy {
            from jar
            into stageDir
        }
    }
}


findbugsMain { ignoreFailures = false }
findbugsTest { ignoreFailures = true }
pmdMain { ignoreFailures = false }
pmdTest { ignoreFailures = true }

checkstyleMain {
    source = 'src/main/java'
}

checkstyle{
    ignoreFailures = true
    showViolations = false
}

tasks.withType(FindBugs) {
    reports {
        xml.enabled = true
        html.enabled = !xml.enabled
    }
}

// Additional dependency configurations.
configurations {
    fortify { extendsFrom compile }
}

clean {
    delete fileTree(dir: "build/")
    delete file("dist/")
}

dependencies {
    checkstyle "com.puppycrawl.tools:checkstyle:8.14"
    
    fortify "com.fortify:sourceanalyzer:3.90"
    
    compile "org.slf4j:slf4j-api:1.7.+"
    compile 'com.google.code.findbugs:annotations:3.0.1'
    compile 'org.beanio:beanio:2.0.7'
    compile 'commons-lang:commons-lang:2.4'
    compile "commons-io:commons-io:2.4"
    compile 'com.amazonaws:aws-java-sdk-s3:1.9.0'
    compile 'com.zoom.etc.storage:payx-object-storage:2.0.x.master.+'
    compile 'com.zoom.traceability:zoom-traceability-mark-library:2.1.4.master.+'
    compile 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2'
    compile 'org.apache.logging.log4j:log4j-api:2.11.1'
    
    //Jackson -JSON parser for java
    //compile 'com.fasterxml.jackson.core:jackson-databind:2.0.1'
    

    testCompile 'org.codehaus.groovy:groovy-all:2.4.+'
    testCompile "org.easyb:easyb:0.9.6"
    testCompile "org.easyb:easyb-junit:0.5.3"
    testCompile "junit:junit:4.+"
    testCompile "org.easymock:easymock:3.+"
    testCompile "org.slf4j:slf4j-simple:1.7.+"
    testCompile "org.codehaus.groovy.modules.http-builder:http-builder:0.7.+"
    
}

task fortifySetup(dependsOn: clean) << {
    ant.properties['build.compiler']='com.fortify.dev.ant.SCACompiler'
    ant.typedef(name: 'sca', classname: 'com.fortify.dev.ant.SourceanalyzerTask',
    classpath: configurations.fortify.asPath)
}

task fortifyReport(dependsOn: compileJava) << {
    ant.sca(//buildid: buildID ,
        jdk: "1.8",
        debug:true,
        verbose:true,
        failonerror:true,
        scan: true,
        logFile:file("$buildDir/reports/fortify/Fortify.log"),
        resultsFile:file("$buildDir/reports/fortify/${fortify_build_id}.fpr")
        )
        {
            fileset(dir: 'src/main') {
                include(name: '**/*.java')
            }
        }
}

sonarqube {
    properties {
        
        property "sonar.host.url", "${System.env.SONAR_URL}"
        property "sonar.jdbc.url", "${sonar_jdbc_url}"
        property "sonar.jdbc.driverClassName", "${sonar_jdbc_driver}"
        property "sonar.jdbc.username", "${sonar_jdbc_username}"
        property "sonar.jdbc.password", "${sonar_jdbc_password}"
        property "sonar.projectKey", sonar_projectkey
        property "sonar.projectName", sonar_projectname
    }
}

task easyb  << {
       ant.taskdef(name: "easyb", classname:"org.easyb.ant.BehaviorRunnerTask", classpath: sourceSets.test.runtimeClasspath.asPath)
    
       ant.easyb( classpath: sourceSets.test.runtimeClasspath.asPath, failureProperty:'easyb_failed' ) {
           report( location:"${project.testResultsDir}/story.html", format:"html" )
           behaviors( dir: "src/test/behaviors" ) {
               include( name:"**/*.story" )
           }
      }
       ant.fail( if:'easyb_failed', message: 'Failures in easyb stories' )
       println "EasyB Story report can be found at ${project.testResultsDir}/story.html"
}

task runVolumeTest (dependsOn: 'classes', type: JavaExec) {
    main = 'CoreAdvancedPrintFlowOrchestratorImplVolumeTest'
    classpath = sourceSets.test.runtimeClasspath
}

//make sure tests use test resources and test behaviors where TAF utils exist.
sourceSets {
    test {
        resources {
            srcDir "src/test/resources"
            srcDir "src/test/behaviors"
        }
    }
}

// Pre-Release Artifactory Publishing
publishing{
    repositories {
        maven { url 'https://repository.zoom.com:8081/artifactory/prerelease' }
    }
    publications {
        mavenJava(MavenPublication) {
            from components.java

            artifact sourcesJar {
                classifier "sources"
            }
        }
    }
}

task sourcesJar(type: Jar, dependsOn: classes) {
    classifier = 'sources'
    from sourceSets.main.java
}

artifacts {
    archives sourcesJar
}

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http://repository.zoom.com:8081/artifactory/gradle-distributions/gradle-4.5.1-bin.zip

任何关于如何解决这个问题的建议。

共有1个答案

伏欣悦
2023-03-14

从属记数法'com/zoom/ans:完整顺序: dmz.100'看起来相当不寻常。正如评论中已经提到的,我的预感是它只是碰巧与旧的Gradle版本一起工作,从来没有得到官方支持,因此现在与Gradle 6断开了。

仍然有许多部分缺失,以绝对确定,但考虑到您的依赖库似乎是用group'com.zoom.ans'发布的,我希望它可以使用以下依赖声明来解决:

dependencies {
    implementation('com.zoom.ans:complete-order:dmz.100')
}

如果它不起作用,那么你应该在http://repository.zoom.com:8081/artifactory/搜索你的艺术工厂服务器的预发布存储库,寻找名称中包含完整订单完整订单-dmz.100或类似内容的工件。通常,您可以浏览存储库树来找到所需的JAR文件,选择它,并在右侧找到一个“依赖声明”部分,在那里您可以选择“Gradle”来查看正确的组名称等。(看起来应该类似于此)。

 类似资料:
  • 我正在将一个组件打包到jar文件中,并试图将其安装到另一个系统中进行开发。我正在使用maven安装该文件,如下所示(摘自https://maven.apache.org/plugins/maven-install-plugin/examples/custom-pom-installation.html): Maven报告jar已成功安装: 我看到jar和pom文件都放在/home/user/中。m

  • 当我试图导入依赖项时,我收到以下错误: 请帮帮我,我哪里错了? 事先谢谢你

  • 我有一个源代码,它读取文本文件并存储到一个元组类型的向量中: 包含以下数据: 因此数据由空格+垂直线+空格(多重分隔符)分隔。 如何更改源代码以处理多个分隔符? 注意:如果数据仅用空格隔开,则程序可以工作。

  • 根据http://apiux.com/2013/03/20/5-laws-api-dates-and-times/我们应该使用ISO 8601来格式化日期。我系统上的输出是: 哪个java格式化程序能正确解析这个字符串?我试过DateTimeFormatter.ISO_OFFSET_DATE_TIME和其他几个,他们不喜欢这种格式。我希望像Oracle在其页面上声称的那样,这种格式应该是开箱即用的

  • 我想使用hbase hortonworks连接器。github指南 但是我不知道如何在我的项目中导入它。我有以下build.sbt: 它给出了以下未解决的依赖关系: 错误:导入SBT项目时出错: [警告]==本地:尝试[警告]常春藤。xml[警告]==公共:已尝试[警告] https://repo1.maven.org/maven2/com/hortonworks/shc/1.1.2-2.1-s_