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
commons-vfs2-bom has commons-vfs2-project as a parent. When you import it into a different project, you expect to have this project's dependencies managed only, but instead, you get numerous other dependencies managed from commons-vfs2-project and its parents.
This pull request detaches the BOM from its parent, which is the only way to get rid of unwanted dependency management.
Unfortunately, as the BOM is part of the reactor, other parts of the parent POM are required for the build to succeed, and we must manually copy them. The only solution for this would be to remove the BOM from the reactor itself, as building a BOM is trivial and probably allows for a much simpler POM file to be written for it. However, the BOM would then need to be built separately.
The root of the project is the BOM POM. It defines the versions of all the artifacts that will be created in the library. Other projects that wish to use the library should import this POM into the dependencyManagement section of their POM.
and
The parent subproject has the BOM POM as its parent. It is a normal multiproject pom.
This can't be done in Apache Commons projects because they need to inherit from org.apache.commons:commons-parent.
We also can't make the BOM inherit from commons-parent because it would also inherit unwanted dependency management, namely, junit and mockito. Avoiding this implies removing the dependency management section from commons-parent, which implies adding it to the parent of every single project under it.
The solutions I can think of are:
Leave things the way they are. Then, the only way to fix the problem would be to remove the dependency management section from commons-vfs2-project. You would still be inheriting unwanted dependency management from commons-parent.
Follow the Maven documentation recommendations. Then the BOM will inherit from commons-parent, and commons-vfs2-parent will inherit from the BOM. You would still be inheriting unwanted dependency management from commons-parent.
Modify the BOM so that it does not have a parent, and keep it within the reactor. This way, you don't have the option to import the BOM into the parent's dependency management section.
Modify the BOM so that it does not have a parent, remove it from the reactor, and import it into the parent. But then you need to build the BOM independently of (and before) the other modules.
This draft PR implements option 3, but any option is acceptable for me.
Option 1:
org.apache:apache
|
-- commons-parent -> Ideally, we would remove the dependency management.
|
---- commons-vfs2-project -> We need to remove the dependency management and move it somewhere else.
|
------ commons-vfs2-bom
------ (other vfs2 modules)
Option 2:
org.apache:apache
|
-- commons-parent -> Ideally, we would remove the dependency management.
|
---- commons-vfs2-bom -> Most similar to Maven recommendations.
|
------ commons-vfs2-project
|
-------- (other vfs2 modules)
Option 3:
org.apache:apache
|
-- commons-parent
|
---- commons-vfs2-project --- Included in the reactor ---> commons-vfs2-bom -> Can't be imported into the parent.
|
------ (other vfs2 modules)
Option 4:
org.apache:apache
|
-- commons-parent
|
---- commons-vfs2-project --- Imported --> commons-vfs2-bom -> Needs to be built independently.
|
------ (other vfs2 modules)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
commons-vfs2-bom has commons-vfs2-project as a parent. When you import it into a different project, you expect to have this project's dependencies managed only, but instead, you get numerous other dependencies managed from commons-vfs2-project and its parents.
This pull request detaches the BOM from its parent, which is the only way to get rid of unwanted dependency management.
Unfortunately, as the BOM is part of the reactor, other parts of the parent POM are required for the build to succeed, and we must manually copy them. The only solution for this would be to remove the BOM from the reactor itself, as building a BOM is trivial and probably allows for a much simpler POM file to be written for it. However, the BOM would then need to be built separately.
Link to the Jira issue: VFS-860