[GRADLE-1709] Default 'runtime' configuration in the Java plugin should not extend 'compile', or have an easy way to override default behaviour Created: 01/Aug/11  Updated: 23/Jan/13  Resolved: 23/Jan/13

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-4
Fix Version/s: None

Type: Bug
Reporter: Rodion Moiseev Assignee: Unassigned
Resolution: Not A Bug Votes: 1


 Description   

By default, java plugin generates a set of dependency configurations (as pointed out here: http://www.gradle.org/java_plugin.html#tab:configurations ) where 'runtime' configuration extends 'compile' configuration. However, this default set up is hardly common. On opposite, 'compile' extending 'runtime' is something I have encountered quite a few times.

For instance, project may contain compile-time-only dependencies such as FindBugs (source code checker) or Lombok (javac integrated byte-code generation tool). In both cases, such tools often use compile-time-only annotations that help during the compilation phase, but are not needed during runtime.

In my opinion, neither 'runtime' nor 'compile' should extend each other, because that's very specific to the project.

Alternatively, there should be a simple (and documented) workaround that does not involve creating a custom configuration (e.g. 'myCompile'), because in most projects it is desirable to stick to conventional 'compile' and 'runtime' configuration naming.

Note: Trying to "override" the default extends-behaviour using 'compile.extendsFrom runtime' gives a circular dependency error. Any better way of doing this??



 Comments   
Comment by Luke Daley [ 23/Jan/13 ]

You can configure runtime to not extend compile by:

configurations {
  compile.extendsFrom -= [runtime]
}
Generated at Wed Jun 30 12:02:22 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.