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

Herve Boutemy commented on MSHADE-339:
--------------------------------------

it seems we now agree on changing the PR to not override classifier but use the 
default value:
{code:java}projectHelper.attachArtifact( project, "test-jar", shadedTests 
);{code}

on deciding whether this change should really be done instead of letting 
initial 
{code:java}projectHelper.attachArtifact( project, "jar", "tests", shadedTests 
);{code}

we perfectly see the difference in the 2 Artifact objects that are created by 
these 2 API calls, that map to the same file (classifier + extension): notice 
that these objects are not equal given equals() implementation that uses 
groupId, artifactId, version, type and classifier

Now, in the context of the project attaching the artifact, the project does not 
care: it does not use the artifact as a dependency.
In the context of another project that would use the file as a dependency, it 
would create another Artifact instance with the expected type for the 
dependency, and that would match the file. The resolution of the dependency 
happens at File level, as resolved from repositories: the artifact instance 
that created the file has no impact. Reactor resolution optimization does the 
same, using extension: 
https://maven.apache.org/ref/3.6.3/maven-core/xref/org/apache/maven/ReactorReader.html#L232
 (notice that Artifact here is org.eclipse.aether.Artifact, that perfectly 
separates Artifact and Dependency notions: it learned from initial Maven 
mistake)

I'm confident that ITs will prove that both codes work.
I'm clear that the "test-jar" is what the API intended.
I'm sure that "jar" + "tests" is what best represents the reality in the 
context of the project that attach the file, and that when we refactor Maven's 
Artifact to split its dependency aspects, "test-jar" won't work any more at 
artifact level but only at dependency level

I'm torn if the PR should be applied :/


> Shaded test jar has wrong type "jar"
> ------------------------------------
>
>                 Key: MSHADE-339
>                 URL: https://issues.apache.org/jira/browse/MSHADE-339
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.2, 3.2.2
>            Reporter: Peter De Maeyer
>            Priority: Minor
>             Fix For: 3.2.2
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The shaded test jar has the wrong type "jar".
> It should be "test-jar".



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

Reply via email to