Gradle 7 war发布到artifactory不工作



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

我能够在本地正确构建war并能够运行应用程序,但在向Artifactory发布war时,我没有看到完整的文件块,我曾经看到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

最新更新