繁体   English   中英

Gradle 7 war 发布到 artifactory 不工作

[英]Gradle 7 war publishing to artifactory not working

我已将项目从 JDK 8 升级到 JDK 17,从 Gradle 4 升级到 Gradle 7。

我能够在我的本地正确构建战争并能够运行应用程序但是在向 Artifactory 发布战争时我没有看到完整的文件块,我曾经看到过 gradle 4 及以下错误在日志中可见。

下面是发布任务定义:

publishing {
    publications {
        product(MavenPublication) {
            artifactId "$project.name"
            artifact war
            
            pom.withXml {
                def dependenciesNode = asNode().appendNode('dependencies')

                configurations.compileClasspath.allDependencies.each {
                    def dependencyNode = dependenciesNode.appendNode('dependency')
                    dependencyNode.appendNode('groupId', it.group)
                    dependencyNode.appendNode('artifactId', it.name)
                    dependencyNode.appendNode('version', it.version)
                }
            }
        }
    }
}

使用的插件

plugins {
    id 'org.springframework.boot' version '2.7.4'
    id 'io.spring.dependency-management' version '1.0.14.RELEASE'
    id 'java'
    id 'war'
    id 'idea'
    id 'eclipse'
}

错误:

> Task :project.package:publishProductPublicationToArtifactoryRepository
Execution optimizations have been disabled for task ':project.package:publishProductPublicationToArtifactoryRepository' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'project-name-1.3.18-SNAPSHOT.war'. Reason: Task ':project.package:publishProductPublicationToArtifactoryRepository' uses this output of task ':project.package:bootWar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
 Please refer to https://docs.gradle.org/7.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Cannot upload checksum for snapshot-maven-metadata.xml because the remote repository doesn't support SHA-512. This will not fail the build.
Cannot upload checksum for module-maven-metadata.xml because the remote repository doesn't support SHA-512. This will not fail the build.

最后我得到了解决方案,以下是发布任务所需的更改

publications {
        product(MavenPublication) {
            artifactId "$project.name"
            artifact bootWar

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM