[英]Gradle 7 war publishing to artifactory not working
I have upgraded my project from JDK 8 to JDK 17 and from Gradle 4 to Gradle 7.我已将项目从 JDK 8 升级到 JDK 17,从 Gradle 4 升级到 Gradle 7。
I am able to build war properly in my local and able to run the application but while doing publish war to Artifactory I do not see complete files chunks which i used to see with gradle 4 and below errors are visible in log.我能够在我的本地正确构建战争并能够运行应用程序但是在向 Artifactory 发布战争时我没有看到完整的文件块,我曾经看到过 gradle 4 及以下错误在日志中可见。
Below is publishing task definition:下面是发布任务定义:
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)
}
}
}
}
}
Plugin used使用的插件
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'
}
Error:错误:
> 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.
Finally I got the solution, below are required changes in publishing task最后我得到了解决方案,以下是发布任务所需的更改
publications {
product(MavenPublication) {
artifactId "$project.name"
artifact bootWar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.