Gradle 9: WAR plugin generates both WAR and JAR – how to disable JAR?

Hi,
I’m working on upgrading the artifactory-gradle-plugin to be compatible with Gradle 9 (specifically milestone 9), and I encountered a change in behavior related to the war plugin.

Previously (in Gradle 8.x and earlier), applying the war plugin would only generate a .war file by default. However, with Gradle 9, I’ve noticed that applying the war plugin now results in both a .war and a .jar being generated for the project.

This is causing issues in our test suite, which expects only the WAR file to be present. According to the Gradle documentation, the JAR task should be disabled automatically when the WAR plugin is applied, but that doesn’t seem to be the case anymore in Gradle 9.

Questions:

  • Is this new behavior expected in Gradle 9?
  • Is there a configuration option to enable this behaviour?
  • Has the default behavior of the WAR plugin changed, or could this be a regression?

Any guidance or clarification would be greatly appreciated. Thanks!

You should either way open an issue, as it is inconsistent with the docs.

The docs still say that the war plugin disables building of the jar.

But if you look at Upgrading your build from Gradle 8.x to 9.0, this was an intentional change.

1 Like