When publishing from a Spring Boot 2.2.9 project using Gradle 6.6 I’m seeing this error:
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Artifact my-app-1.1.0.war wasn't produced by this build.
The release notes for upgrading to version 6.2 state this:
Starting from Gradle 6.2, Gradle performs a sanity check before uploading, to make sure you don’t upload stale files (files produced by another build). This introduces a problem with Spring Boot applications which are uploaded using the
components.java
component:
A code snippet is provided for how to publish artifacts successfully when your artifact is a jar file. However, the artifact I want to publish is a war file created with ./gradew bootWar
. I’ve tried making the following addition to my build.gradle:
configurations {
[apiElements, runtimeElements].each {
it.outgoing.artifacts.removeIf { it.buildDependencies.getDependencies(null).contains(war) }
it.outgoing.artifact(bootWar)
}
}
I’ve taken the suggestion and changed jar to war. However, I still experience the same error.
Any suggestions are appreciated. Thanks.