8.2. Declaring your dependencies - explanation wrong?


(Robert Kühne) #1

I’m not sure about this sentence in chapter 8.2:

By implication, Hibernate core and its dependencies are also required at runtime.

The code states that it is a compile time dependency and in 8.3 it is explained that runtime includes compile dependencies which is the reversed. Am I missing something here?


(Peter Niederwieser) #2

Compile dependencies are usually also required at runtime. Gradle honors this by making the ‘runtime’ configuration extend the ‘compile’ configuration.


(Robert Kühne) #3

Yes, this is the way I assumed it works. But the example given and the text below don’t fit. I think instead of

compile group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'

it should be

runtime group: 'org.hibernate', name: 'hibernate-core', version: '3.6.7.Final'

Or, the sentence “By implication, Hibernate core and its dependencies are also required at runtime.” does mean something different than i thought. What is the implication referred to?


(Peter Niederwieser) #4

The example is correct. Maybe the text could be rephrased. The implication is “x is compile dependency => x is runtime dependency”.


(Robert Kühne) #5

Oh, it just made click. A compile time dependency is always a runtime dependency, too. Sorry, this is so simple that I’m embarrassed I asked. A little venn diagram popped up in my head and the fog cleared. Thanks for you help!