[GRADLE-2113] Error generating manifest in WAR where excluded dependencies are getting included Created: 21/Feb/12  Updated: 04/Jan/13  Resolved: 28/Feb/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-7, 1.0-milestone-8, 1.0-milestone-8a
Fix Version/s: None

Type: Bug
Reporter: Gradle Forums Assignee: Szczepan Faber
Resolution: Not A Bug Votes: 0


 Description   

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



 Comments   
Comment by Gradle Forums [ 21/Feb/12 ]

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

Comment by Szczepan Faber [ 21/Feb/12 ]

BTW. also reported here: http://support.gradleware.com/tickets/1158

Comment by Szczepan Faber [ 22/Feb/12 ]

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.

Comment by Szczepan Faber [ 27/Feb/12 ]

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.

Comment by Luke Daley [ 28/Feb/12 ]

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

Comment by Luke Daley [ 28/Feb/12 ]

Thanks, is there a jira ticket I can watch?

Comment by Luke Daley [ 28/Feb/12 ]

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

Generated at Wed Jun 30 12:13:09 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.