[GRADLE-2291] Exclusions set on all configurations not honoured by detachedConfiguration3 while executing eclipseWtpComponent Created: 10/May/12  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-rc-3
Fix Version/s: None

Type: Bug
Reporter: Mauro Molinari Assignee: Unassigned
Resolution: Won't Fix Votes: 4


 Description   

I have a project with the following:

apply plugin: 'war'
apply plugin: 'eclipse-wtp'

configurations.all {
  exclude group: 'com.sun.jdmk', module: 'jmxtools'
  exclude group: 'com.sun.jmx', module: 'jmxri'
  exclude group: 'javax.jms', module: 'jms'
}

dependencies {
  compile 'log4j:log4j:1.2.15'
}

repositories { 
  mavenCentral()
}

Those exclusions are needed because log4j depends on those libraries that do not have associated JARs in Maven Central. This is a problem since Gradle 1.0-milestone-7 (see also GRADLE-2046) and "global" exclusion is the workaround I was suggested to apply, since I don't need those libraries. However, this does work when invoking "gradle build", but it does not when invoking "gradle eclipse":

> Building > :myproject:eclipseWtpComponent > Resolving dependencies 'detachedConfi
:myproject:eclipseWtpComponent

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':myproject:eclipseWtpComponent'.
> Could not resolve all dependencies for configuration 'detachedConfiguration3'.

   > Artifact 'javax.jms:jms:1.1@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

It seems like "detachedConfiguration3" is created afterwards and it doesn't inherit the exclusions previously set. I made some tests, but I wasn't able to make this configuration to use the exclusions.

What I had to do to work around this problem is quite "dirty":

  • I had to move the exclusion to log4j dependency definition:
    compile('log4j:log4j:1.2.15') {
      exclude group: 'javax.jms', module: 'jms'
      exclude group: 'com.sun.jdmk', module: 'jmxtools'
      exclude group: 'com.sun.jmx', module: 'jmxri'
    }
    
  • then, I also had to exclude log4j from any other library that depends on it, otherwise the libraries I want to exclude where coming in again as a transitive dependency of log4j coming itself from other dependencies, for instance:
    compile('poi:poi:3.0.2-FINAL') {
      exclude group: 'log4j', module: 'log4j'
    }
    

However, this workaround is quite error prone and badly maintainable.



 Comments   
Comment by Andreas Schmid [ 14/Dec/14 ]

I cannot reproduce the behaviour using Gradle 2.0. Is that correct?

Comment by Mauro Molinari [ 14/Dec/14 ]

I trust you if you say it now works. Unfortunately, I don't work anymore for the company where I had the actual project where I needed the global exclusions I mentioned in my original report. So, if the simple test case I provided now works, I would say it's ok in Gradle 2.0 now.

Comment by Andreas Schmid [ 14/Dec/14 ]

Yes, in my test I copied your reproducer and it has worked for me

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

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