Gradle - what is runtime dependency configuration used for?

Could you please help me understand what are the typical use cases in which dependency configuration runtime

(provided by the Java plugin) can be used ?

In the Gradle User Guide, Table 23.5. Java plugin dependency configurations, I can see that the runtime configuration is not used by any tasks - unlike, for example, the configuration compile

that is used by a task compileJava

.

What is addiction runtime

useful for?

+3


source to share


1 answer


Runtime configuration is for libraries that are needed at runtime, but NOT at compile time (e.g. JDBC drivers and SLF4J api implementation).

You can just add them to your compilation config, but then they will be on the way to compile the classes, and you risk accidentally introducing compilation dependencies on something from the implementation, not the api.



This is not for libraries that are "provided" by the container — in fact, you are providing libraries to your application, without thinking that you have not provided compilation for them.

+6


source







All Articles