Hi! I am using Gradle 7.6. I have a tasks for crea...
# gradle
m
Hi! I am using Gradle 7.6. I have a tasks for creating a
shadowJar
Copy code
withType<ShadowJar> {
    archiveFileName.set("app.jar")
    manifest {
        attributes["Main-Class"] = "no.nav.sokos.prosjektnavn.BootstrapKt"
    }
}
But it appears two jars? One with
app.jar
and one with name of the project
projectName.jar
, why two jars? If i remove
archiveFileName.set("app.jar")
the i get
projectName.jar
and
projectName-all.jar
. How can I make my Gradle config so I only have one jar with name
app.jar
?
t
Isn't you asked the similar question here? 🤔
m
Yes i did. But now I have same issue again. Because using
Copy code
withType<Jar> {
    isEnabled = false
}
There is no
libs
folder when it have built the project. Means no jars at all.
Copy code
withType().named("jar") {
    enabled = false
}
This above solution is working. But below solution this not working? 🤔
Copy code
withType<Jar> {
    isEnabled = false
}
Why?
v
The shadow jar task is also a task of type
Jar
. So if you set
isEnabled = false
for all tasks of type
Jar
you also disable the fat jar building. With
named("jar")
you configure only exactly that task named
jar
.
m
When i asked this question earlier it worked with the solution i got earlier. But after upgrading jvm to newest version I needed to change how to disable the task named
jar
🙂