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 {
  mavenCentral()
   }
  configurations {
 warManifest
   }
  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 ("jboss:javassist:3.4.ga") { force = true }
      warManifest ('org.hibernate:hibernate:3.2.5.ga') {
  force = true
  exclude module: 'jta'
  exclude module: 'cglib'
 }
            warManifest (group: "org.hibernate", name: "hibernate-entitymanager", version: "3.3.1.ga", configuration: "default")
{
  exclude module: 'persistence-api'
  exclude module: 'jboss-common-core'
 }
  }
  war {
    baseName = 'test'
    dependsOn jar
        classpath = jar.archivePath
          doFirst {
        manifest {
   attributes(
                "Class-Path": configurations.warManifest.collect { File file -> file.name }.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.

BUILD FAILED

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: http://support.gradleware.com/tickets/1158

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: http://gradle.org/docs/nightly/userguide/userguide_single.html#exclude-dependencies

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