Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commons-collections4 should be api dependency #1120

Closed
Vampire opened this issue Oct 8, 2019 · 2 comments
Closed

commons-collections4 should be api dependency #1120

Vampire opened this issue Oct 8, 2019 · 2 comments
Labels
bug status: completed has been completed but is not yet released

Comments

@Vampire
Copy link
Contributor

Vampire commented Oct 8, 2019

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.

@MinnDevelopment
Copy link
Member

You're right, I forgot to change it to api when I added the bag methods. PRs welcome.

@Andre601
Copy link
Contributor

Andre601 commented Oct 8, 2019

So just change a dependency to api?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status: completed has been completed but is not yet released
Projects
None yet
Development

No branches or pull requests

3 participants