Error generating manifest in WAR where excluded dependencies are getting included

I’ve upgraded from milestone-3 to milestone-8a and noticed a problem when I generate manifest files in a WAR.

I set excludes for some of the transitive dependencies (like the JTA jar file), however in milestone-8a these excluded dependencies are getting included in the generated manifest file.

I normally use a local Ivy repository (which does include the JTA) however for the purposes of a simple re-creatable the example below uses maven central.

apply plugin: 'war'
  repositories {
  configurations {
  dependencies {
   warManifest group: 'cglib', name: 'cglib-nodep', version: '2.1_3'
 warManifest group: "jboss", name: "jboss-archive-browsing", version: "2.0.2.alpha"
   //hibernate has dependencies on older versions of these JAR's - override to use our versions
 warManifest ("") { force = true }
      warManifest ('') {
  force = true
  exclude module: 'jta'
  exclude module: 'cglib'
            warManifest (group: "org.hibernate", name: "hibernate-entitymanager", version: "", configuration: "default")
  exclude module: 'persistence-api'
  exclude module: 'jboss-common-core'
  war {
    baseName = 'test'
    dependsOn jar
        classpath = jar.archivePath
          doFirst {
        manifest {
                "Class-Path": configurations.warManifest.collect { File file -> }.sort().join(' ') )

When I run the war task I get the error below. As you can see the error occurs resolving javax.transaction:jta:1.0.1B - which should have been excluded. This runs OK on milestone-3. Has something changed around the WAR task or the way excluded dependencies are managed? I’ve read through the release notes etc for all the releases between milestone-3 and 8 but didn’t spot anything.

F:\tmp\gradle-exclude-test>gradle clean war :clean :compileJava :processResources UP-TO-DATE :classes :jar :war

FAILURE: Build failed with an exception.

  • Where: Build file ‘F:\tmp\gradle-exclude-test\build.gradle’ line: 39

  • What went wrong: Execution failed for task ‘:war’. > Could not resolve all dependencies for configuration ‘:warManifest’.

Artifact ‘javax.transaction:jta:1.0.1B@jar’ not found.

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.


I think this is a bug. I’m just replicating it with a simple example…

I’ve exported it to jira and I’ve narrowed down the example.

Thanks, is there a jira ticket I can watch?

Sure it’s GRADLE-2113 and it’s not a bug. Take a look at the jira ticket for further details.

BTW. also reported here:

This is not a bug. I’ll fix the documentation and once it’s done I’ll close this issue with a link to the docs.

Updated the documentation, see:

Also, I’ve updated the release notes to include this potential breaking change.