1

I use version Gradle 6.8.3

I want to use gradle clean build, but I have cannot make fatJar use gradle.

Here is my task for 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
}

and here is my error:

Configure project : The AbstractArchiveTask.version property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveVersion property instead. See https://docs.gradle.org/6.8.3/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:version for more details. at build_ctf8avxcswmp4us7papf7uvsh$_run_closure3$_closure9.doCall(C:\Users\LTP-20090289\IdeaProjects\belajarspringboot\build.gradle:32) (Run with --stacktrace to get the full stack trace of this deprecation warning.) The AbstractArchiveTask.baseName property has been deprecated. This is scheduled to be removed in Gradle 7.0. Please use the archiveBaseName property instead. See https://docs.gradle.org/6.8.3/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:baseName for more details. at build_ctf8avxcswmp4us7papf7uvsh$_run_closure3.doCall(C:\Users\LTP-20090289\IdeaProjects\belajarspringboot\build.gradle:36) (Run with --stacktrace to get the full stack trace of this deprecation warning.)

My question is how to make fatJar use gradle 6.8.3?

Spyros K
  • 2,480
  • 1
  • 20
  • 37
jujol
  • 21
  • 2

1 Answers1

0

The messages inform you that some properties are deprecated and will be removed in the version 7.0. If you want to remove the message warnings and be compatible with gradle 7.0 you need to replace version with archiveVersion and name with archiveBaseName. These messages should be just warnings, not errors. This means that these message warnings do not prevent the project from building. If you cannot build your project then most probably there is a different cause.

This should remove the warnings:

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
}
Spyros K
  • 2,480
  • 1
  • 20
  • 37