[ 
https://issues.apache.org/jira/browse/MNG-6450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17235257#comment-17235257
 ] 

Arnoud Glimmerveen commented on MNG-6450:
-----------------------------------------

I stumbled on this issue as well, when trying to generate a BOM, attaching it 
to a project and trying to import it in another project.

[~rfscholte]: I may have a scenario were you'd want to generate a BOM rather 
then manually creating one. In my scenario I have various multi-module Maven 
project, and there are dependencies between them (i.e. modules from project B 
depending on one or more modules from project A). In addition, each project 
typically depends on various external libraries as well, creating the need to 
manage these versions. I end up with a situation where the top-level POM of my 
project A has a dependency management section containing both entries related 
to modules from within the multi-module project A *and* entries towards 
external libraries. This by itself is not an issue, however when I want to use 
that top-level POM file as BOM to import in project B, I import the entire 
dependencyManagement from A, even-though I only wanted to import the entries 
related to the modules from A. Due to the particular behaviour of Maven with 
regards to order in which entries in dependencyManagent are declared, if 
project B imports the BOM of A but wants retain control of the version of the 
external libraries, it must make sure it declares these versions before 
importing the BOM. This gets increasingly more tricky to manage when the number 
of multi-module projects and the dependencies between them increases. This 
prompted me to try to generate the BOM from the top-level BOM, by creating a 
copy of that top-level POM and filtering the dependencyManagement section to 
only retaining entries referencing the modules from within the multi-module 
project, and attaching it as an additional artifact to the top-level project. 
Unfortunately, the requirements for importing restrict this from working, as 
the type must be pom and no classifier may be set. Any thoughts on this 
scenario, is there an alternative approach I could try out?

> Allow importing a POM with a classifier
> ---------------------------------------
>
>                 Key: MNG-6450
>                 URL: https://issues.apache.org/jira/browse/MNG-6450
>             Project: Maven
>          Issue Type: Improvement
>          Components: Dependencies, POM
>    Affects Versions: 3.0
>            Reporter: Yegor Borovikov
>            Priority: Major
>              Labels: easy-fix, pull-request-available
>
> Currently, a POM-packaged artifact with a classifier cannot be imported - 
> there is an explicit check for that in 
> [DefaultModelValidator|https://github.com/apache/maven/blob/master/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java#L480].
>  I couldn't find anything in Maven documentation that would mention/explain 
> this limitation. According to [~rfscholte] this [might 
> be|https://www.mail-archive.com/[email protected]/msg114101.html] 
> "historical".
> Example use case: a BOM (bill of materials) plugin could generate a BOM POM 
> and attach it (with a classifier) to the project. However, currently there's 
> no way to import the generated BOM because of the restriction.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to