我使用Gradle 6.8.3 版本
我想使用gradle干净的构建,但我不能让fatJar使用gradle。
这是我为fatJar 完成的任务
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'com.cekpremi.example'
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
这是我的错误:
配置项目:AbstractArchiveTask.version属性已已弃用。这计划在Gradle 7.0中删除。请使用而是archiveVersion属性。看见https://docs.gradle.org/6.8.3/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:version了解更多详细信息。在build_ctf8avxcswmp4us7papf7uvsh$_run_closure3$_closure9.doCall(C:\Users\LTP--20090289\IdeaProjects\belajarspringboot\build.gradle:32((使用--stacktrace运行以获取此弃用警告的完整堆栈跟踪。(AbstractArchiveTask.baseName属性已被弃用。这计划在Gradle 7.0中删除。请使用archiveBaseName属性。看见https://docs.gradle.org/6.8.3/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:baseName了解更多详细信息。在build_ctf8avxcswmp4us7papf7uvsh$run_closure3.doCall(C:\Users\LTP-20002089\IdeaProjects\belajarspringboot\build.gradle:36((使用--stacktrace运行以获取此弃用警告的完整堆栈跟踪。(
我的问题是如何让fatJar使用等级6.8.3?
消息通知您某些属性已弃用,并且将在版本7.0
中删除。如果要删除消息警告并与gradle 7.0
兼容,则需要用archiveVersion
替换version
,用archiveBaseName
替换name
。这些消息应该只是警告,而不是错误。这意味着这些消息警告不会阻止项目的生成。如果你不能建立你的项目,那么很可能有不同的原因。
这将删除警告:
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': archiveVersion ,
'Main-Class': 'com.cekpremi.example'
}
archiveBaseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}