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

Martin Todorov commented on MINDEXER-49:
----------------------------------------

[~paleozogt],

 

The problem is more along due to the following:
 * One POM file can define one artifact. (Sure, you can use the 
build-helper-maven-plugin to add additional ones, but they are never reflected 
in the uploaded POM file).
 * You can't always guess the extension properly. You can guess simple 
extensions like jar, war, zip, but will fail with parsing the extensions for 
tar.gz, tar.bz2 and so on, unless you have an exact list of all possible 
extensions...

So, if you were to scan a directory that contains such artifacts, how would you 
locate the artifacts?

How would you figure out what the extension is?

How would you know where the classifier ends when you have a complex extension 
like the above? You will end up getting classifiers like gcc4.4.5.tar. Clearly, 
this is not what you'd want.

 

If you have suggestions and advice, do share!

 

> M2GavCalculator does not parse GAV correctly for classifiers with dots
> ----------------------------------------------------------------------
>
>                 Key: MINDEXER-49
>                 URL: https://issues.apache.org/jira/browse/MINDEXER-49
>             Project: Maven Indexer
>          Issue Type: Bug
>    Affects Versions: 4.1.1, 4.1.2
>         Environment: all
>            Reporter: René Zanner
>            Priority: Critical
>
> When having a classifier with dots (classifier.with.dots) and an extension 
> with or without dots (e.g. tar.gz), the calculation of Gav changes classifier 
> and type/extension to something clearly not intended:
> || ||Attached artifact definition||M2GavCalculator result||
> ||classifier|classifier.with.dots|classifier|
> ||extension/type|tar.gz|with.dots.tar.gz|
> The problem seems to be located in lines 136ff, 175ff *and* 216ff (do you 
> have a code duplication issue as well? ;-) ): 
> {code}
> int nExtPos = tail.indexOf( '.' );
> ...
> ext = tail.substring( nExtPos + 1 );
> classifier = tail.charAt( 0 ) == '-' ? tail.substring( 1, nExtPos ) : null;
> {code}
> This code assumes that the classifier ends at the first dot in the "tail" 
> (which is everything after the version number).
> Since Maven allows dots in classifiers _as well as in extensions_, the 
> parsing has to be made more intelligent. So, it is not enough to just turn 
> the parsing around and use the part after the last dot as extension and 
> before it as classifier (that's why I used the 'tar.gz' extension in my 
> example above).
> I do not have a solution for this except checking for well-known extensions 
> (tar.gz, xml, jar, zip, a.s.o.) and build the classifier/extension parsing 
> around it.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to