-
Notifications
You must be signed in to change notification settings - Fork 264
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
test
scope of guava in BOM
#1084
Comments
Not having a runtime time dependency on guava was a deliberate choice. What
exactly is the problem?
…On Mon, 5 Jul 2021, 08:24 Alexander Idelberger, ***@***.***> wrote:
Importing the bill of materials can cause problems with due to test scope
of Guava.
Description
Guava is usually not used for test code only but the BOM defines the scope
test in the dependencyManagement section.
Expected Behavior
I add the dependency of guava without defining a scope, I expect it to
have the default scope of compile.
Actual Behavior
Guava is not present as compile scope even though it is declared as
dependencies with the default scope.
Possible Fix
Move the test scope from dependencyManagement to dependencies.
Steps to Reproduce
1. Create a maven project
2. Import the BOM
3. Add Guava as dependency without specifying the scope.
Context Your Environment
- Version used: 2.11.0
- Link to your project: internal
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1084>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADI7HN3PQ5CHXLIPYEVHH3TWFF2PANCNFSM472B2R2A>
.
|
Putting it in the dependencyManagement section changes the default scope when you declare Guava as dependency (and use the logbook BOM). This can even blow up during runtime as it happen to me:
|
Riptide does depend on guava in Let's dig deeper into this issue. Just changing guava's scope to compile for all of logbook is wrong, since Logbook doesn't depend on guava. |
Let me reproduce it in a minimal example. |
To reproduce the issue, run You will get
|
By the way that is not what I am proposing but defining the |
It's still wrong though, since Logbook doesn't need Guava at runtime. Riptide does. |
I can't find anything on how Maven is supposed to behave in this situation.
Seems like Maven always chooses test over compile for conflicts like this. The only viable workaround that I see is to duplicate the guava dependency in your project. |
Could it be that it treats explicitly defined scope over implicit default scope? Haven't tried it though…
Yes, That is exactly what I did in my project.
I don't understand why you consider it to be wrong to define the scope differently as it doesn't change the effective dependencies of logbook. If you look at other BOMs, e.g. spring-boot-dependencies, you rarely see a scope defined. |
Nevermind. I understood it as changing it from test to compile implicitly by removing the scope declaration in the dependency management section. Only now I realized that you opened a PR already. |
Importing the bill of materials can cause problems with due to
test
scope of Guava.Description
Guava is usually not used for test code only but the BOM defines the scope
test
in thedependencyManagement
section.Expected Behavior
I add the dependency of guava without defining a scope, I expect it to have the default scope of
compile
.Actual Behavior
Guava is not present as
compile
scope even though it is declared as dependencies with the default scope.Possible Fix
Move the
test
scope fromdependencyManagement
todependencies
.Steps to Reproduce
Context
Your Environment
The text was updated successfully, but these errors were encountered: