-
Notifications
You must be signed in to change notification settings - Fork 85
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
Not to exclude a test dependency if the dependency is used in another dependency #185
Comments
I think this proposal makes sense. @saturnism @olamy @rfscholte -- could you share your input too? |
took a look in more detail and it does make sense. the exclusion is expected, but the dep should be added back in. |
I fully agree that this is a bug. I have not yet analyzed this. It may be some kind of bug in the maven core classes that are reused (or partially even missused) here or if actually the flatten MOJO itself is the root problem. However, what we do in flatten-maven-plugin is use maven core classes to compute the effective POM and then we strip test dependencies. So what happens in your example project that you created to reproduce the error if you disable |
@hohwille Thank you for comment. Here is the effective pom of the project (without flatten-maven-plugin). https://gist.github.com/suztomo/8bebb45c890a3bbcd4e845fbfc45d559 The dependency C (
Would you elaborate more about this? The project's pom.xml declares the dependency ( |
I'm starting to work on this issue. Our config
Step 1: Create a test that fails in master branch
Project A: I create pom.xml Step 2: Identify which code is responsible removing the test scope dependencies"dependencies" property has "flatten" handling, which picks cleanPom among the argument. createFlattenedDependency returns We have
However, DependencyNode with "omitted for duplicate" are not added to
Step 3: Fix the problemStep 4: Format.Done. |
Suppose we have the following 3 artifacts:
Diagram:
Artifact A's pom.xml is flattened before publishing to Maven Central.
Expected Result
Artifact A's flattened pom.xml does not exclude Artifact C when declaring ArtifactB's dependency. Artifact C may be used only in test in Artifact A, but it's needed by Artifact B.
Actual Result
With current implementation, Artifact A's flattened pom.xml excludes Artifact C from Artifact B's dependency. Artifact A's pom.xml would look like something like this:
Version
flatten-maven-plugin version 1.2.5
Plugin Parameters
from com.google.cloud:google-cloud-shared-config:0.9.4
Real Example
In the example we encountered,
com.google.cloud:google-cloud-spanner-jdbc
com.google.cloud:google-cloud-spanner
com.google.api.grpc:grpc-google-cloud-spanner-admin-database-v1
The published pom.xml of
com.google.cloud:google-cloud-spanner-jdbc
(link) had the unexpected exclusion element:(CC: @stephaniewang526 , thank you for helping me on the troubleshooting last week)
The text was updated successfully, but these errors were encountered: