Java plugin: overriding the default configuration hierarchy

(Jacob Aleksynas) #1

I am migrating a large, long existing ant/ivy implementation. In our existing implementation runtime extends compile (not vice versa as is the default behavior in the java plugin.). Changing this in all modules, descriptors and repositories is a very difficult especially when trying to roll out gradle in parallel.

I have been unable to find a way to access/override the default configuration hierarchy from my gradle scripts ( as I can with the sourceSets for example).

Can any one suggest an approach for altering the default configuration extensions?

(Peter Niederwieser) #2

Try this:

subprojects {
  apply plugin: "java"
  configurations.runtime.extendsFrom = []
  configurations.compile.extendsFrom configurations.runtime

(Jacob Aleksynas) #3

This fix cause some seriously interesting log output… but I did find that this is already and issue in Jira

(Justin Ryan) #4 might be a better fit. I think most teams are used to the provided configuration, it is an alternative to flip-flopping runtime and config. You’ll find these configs (providedCompile and providedRuntime) when you apply the war plugin.

(DoHyung Kim) #5

Is this supposed to work? I’m getting infinite “Failed to notify action.” messages when I try an exactly same script.