How can I exclude dependencies from other subprojects?

This is not a duplicate, as these other solutions do not work.

I have a subproject:

: Common: widget

gradle.build (subproject) resembles this:

configurations {providedCompile} dependencies { compile project(":commons:other-widget") ...other dependencies... } 

If you show dependencies:

 +--- project :commons:some-other-project +--- project :commons:exclude-me-project (*) \--- org.apache.cxf:cxf-rt-frontend-jaxrs: -> 3.0.3 (*) 

What does not work:

Any regular syntax. I have tried all the options that I can think of. I even went looking for the API, but could not find what I needed there.

In this section of the project dependencies: ...

 compile project(":commons:some-other-project") { exclude (":commons:exclude-me-project") } 

Result:

 Could not find method exclude() for arguments [:commons:some-other-project] on project 

I also tried:

 compile ( project (':commons:some-other-project') ) { transitive = false } 

Result: instead of removing the dependencies ": commons: some-other-project", it removes the ": commons: some-other-project".

I have a large and complex project to convert. I have a lot of this kind of work ahead. Given a project as a dependency, how can I exclude things from it?

+7
dependencies gradle
source share
2 answers

exclude for dependencies has a slightly different syntax, so try to do this by providing a module name that is equal to the value of exclude-me-project , for example:

 compile(project(":commons:some-other-project")) { exclude module: "exclude-me-project" } 

Alternatively, you can exclude all transitive dependencies for the commons project, but it will remove all the fingerprints of the some-other-project , including exclude-me-project :

 compile(project(":commons:some-other-project")) { transitive = false } 
+12
source share

You can rename the file as .txt (Refactor - Rename File)

0
source share

All Articles