configurations {
compileInclude {
extendsFrom compile
extendsFrom include
}
}
using the compileInclude
directive in the dependencies
block does not work, but using compile and include separately does.
configurations {
compileInclude {
extendsFrom compile
extendsFrom include
}
}
using the compileInclude
directive in the dependencies
block does not work, but using compile and include separately does.
Hi @martmists,
Can you please clarify what the problem is. Are you saying the this is not working:
configurations {
compileInclude {
extendsFrom compile
extendsFrom include
}
}
dependencies {
compileInclude 'some:dependency:1.0'
}
That should “work”. But what do you mean by “does not work”? Which error are you seeing?
There is no visible error, but it’s not added to the dependencies by IntelliJ nor is it available during compile-time in gradle. It works fine when using compile and include directly.
I think you got it the wrong way around. You need to put your new configuration “below” existing ones. Otherwise, existing tooling (e.g. the classpath resolving) would not know about your new configuration.
For example:
configurations {
compileInclude
compile {
extendsFrom compileInclude
}
include {
extendsFrom compileInclude
}
}
For java library configurations see (note that ‘compile’ is not in there anymore because it is deprecated):
https://docs.gradle.org/current/userguide/java_library_plugin.html#sec:java_library_configurations_graph
if anyone is reading this, an working example, for the case of having a test module (neat, mocked, unit tests) and an itest module (runs in ci, heavy):
itestImplementation {
extendsFrom testImplementation
}
then you have sources in src/java/main, src/java/test, and src/java/itest – and you dont have to redeclare all of your dependencies to see main’s classes, and libs, in test, and you see both main’s and test’s classes and libs inside of itest.