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

Herve Boutemy edited comment on MARTIFACT-44 at 2/21/23 6:57 AM:
-----------------------------------------------------------------

thank you [~nielsbasjes], great IT to share precisely the issue you're facing

here is how to fix: {{artifact:compare}} is not expected to be run in a 
separate mvn invocation, but during the rebuild

ie. your current {{src/it/include-drp/invoker.properties}} that contain 3 
invocations
{noformat}
# 1) install
invoker.goals.1=clean install
# 2) rebuild (without install)
invoker.goals.2=clean verify
# 3) Verify previous two are the same
invoker.goals.3=artifact:compare
{noformat}
should instead define 2 invocations only
{noformat}
# 1) install
invoker.goals.1=clean install
# 2) rebuild (without install) and verify result is the same as installed 
previously
invoker.goals.2=clean verify artifact:compare
{noformat}

with that in place, your IT works seamlessly


was (Author: hboutemy):
thank you [~nielsbasjes], great IT to share precisely the issue you're facing

here is how to fix: {{artifact:compare}} is not expected to be run in a 
separate mvn invocation, but during the rebuild

ie. your current {{src/it/include-drp/invoker.properties}} that contain
{noformat}
# 1) install
invoker.goals.1=clean install
# 2) rebuild (without install)
invoker.goals.2=clean verify
# 3) Verify previous two are the same
invoker.goals.3=artifact:compare
{noformat}

{noformat}
# 1) install
invoker.goals.1=clean install
# 2) rebuild (without install) and verify result is the same as installed 
previously
invoker.goals.2=clean verify artifact:compare
{noformat}

with that in place, your IT works seamlessly

> Handling the dependency-reduced-pom.xml
> ---------------------------------------
>
>                 Key: MARTIFACT-44
>                 URL: https://issues.apache.org/jira/browse/MARTIFACT-44
>             Project: Maven Artifact Plugin
>          Issue Type: Bug
>            Reporter: Niels Basjes
>            Priority: Major
>              Labels: pull-request-available
>
> In my projects I often use the *maven-shade-plugin* to include specific 
> dependencies  in the final jar.
> I do this to avoid version conflicts in dependencies that are very version 
> sensitive like the Antlr4 runtime ( See 
> [https://yauaa.basjes.nl/developer/shadingdependencies/] ).
> So in practice I use the following shading options
>  * relocate: to different package name
>  * minimizeJar: to only keep what is needed
>  * *useDependencyReducedPomInJar* : to make sure that down stream 
> applications do not include the original dependencies anymore that have 
> already been included. 
> https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#useDependencyReducedPomInJar
>  
> An important note about the useDependencyReducedPomInJar is that the actual 
> *pom.xml* that is placed in the jar file has been generated during the build 
> and is thus very different from the *pom.xml* file that is part of the source 
> code.
> When I now run the *compare* goal of this artifact plugin I get this:
> {code:java}
> [ERROR] size mismatch yauaa-7.13.1-SNAPSHOT.pom: investigate with diffoscope 
> analyzer/target/reference/yauaa-7.13.1-SNAPSHOT.pom analyzer/pom.xml {code}
> To me this looks like the goal is comparing the pom of the published jar 
> (generated file; without the shaded dependencies) with the source file (with 
> the shaded dependencies).
> If I do this
> {code:java}
> $ diffoscope analyzer/target/reference/yauaa-7.13.1-SNAPSHOT.pom 
> analyzer/dependency-reduced-pom.xml  {code}
> They are equal.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to