You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your build script you define implementation("org.apache.commons:commons-collections4:4.1").
But commons-collections4 is used in your API (e. g. as return type of several methods in Message).
Due to that it should instead be declared as api("org.apache.commons:commons-collections4:4.1").
This is not only a philosophical change, this is how api and implementation are meant to be used.
And for me it also has a practical impact. (That I of course can work-around easily by including the lib on my compile classpath manually, but I shouldn't need to)
Due to it being defined as implementation dependency it lands as runtime-scoped dependency in the published POM and thus is not part of the compile classpath of Gradle 5+ consumers.
Now I have a project that is a consumer and have a Spock test that mocks a method call of Message.
This causes the test compilation to fail as the Spock Groovy AST transformation tries to get the methods of Message and fails with a NoClassDefFoundError as Bag is not on the compile classpath.
The text was updated successfully, but these errors were encountered:
In your build script you define
implementation("org.apache.commons:commons-collections4:4.1")
.But
commons-collections4
is used in your API (e. g. as return type of several methods inMessage
).Due to that it should instead be declared as
api("org.apache.commons:commons-collections4:4.1")
.This is not only a philosophical change, this is how
api
andimplementation
are meant to be used.And for me it also has a practical impact. (That I of course can work-around easily by including the lib on my compile classpath manually, but I shouldn't need to)
Due to it being defined as
implementation
dependency it lands asruntime
-scoped dependency in the published POM and thus is not part of the compile classpath of Gradle 5+ consumers.Now I have a project that is a consumer and have a Spock test that mocks a method call of
Message
.This causes the test compilation to fail as the Spock Groovy AST transformation tries to get the methods of
Message
and fails with aNoClassDefFoundError
asBag
is not on the compile classpath.The text was updated successfully, but these errors were encountered: