You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "S L (Jira)" <ji...@apache.org> on 2022/02/06 17:50:00 UTC

[jira] [Commented] (MNG-7204) Maven might pick up the wrong configuration when the plugin happens to include relocation information

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

S L commented on MNG-7204:
--------------------------

Thanks for the investigation and determining the root cause! Sorry notifications from maven had been redirected to my spam folder :(

If you had mentioned me great, if not it's fine too :) I really don't mind. Whatever you prefer to be honest.

 

Thanks for the fix!

> Maven might pick up the wrong configuration when the plugin happens to include relocation information
> -----------------------------------------------------------------------------------------------------
>
>                 Key: MNG-7204
>                 URL: https://issues.apache.org/jira/browse/MNG-7204
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.6.1, 3.8.1
>            Reporter: S L
>            Assignee: Michael Osipov
>            Priority: Critical
>         Attachments: MNG-7204.zip, screenshot-1.png
>
>
> h1. Issue Description
> The relocation process is outlined in [here|https://maven.apache.org/guides/mini/guide-relocation.html] and IMHO boils down to adding the relocation information into the distributionManagement.
> For the sake of experimenting assume we want to relocate a plugin from
> {code:java}
>     <groupId>com.example.plugins</groupId>
>     <artifactId>test-plugin</artifactId>
> {code}
> to
> {code:java}
>     <groupId>com.test.plugins</groupId>
>     <artifactId>test-plugin-enhanced</artifactId>
> {code}
> To visualize the issue the plugin needs one configuration parameter (let's call it helloString). Based on the relocation guide my understanding is that we need two publications. One under the old coordinates and one under the new coordinates.
> When invoking the plugin with the old coordinates it will **not** pickup our configuration supplied. Consider:
> {code:java}
> <groupId>com.example.plugins</groupId>
> <artifactId>test-plugin</artifactId>
> <version>0.0.1</version>
> <configuration>
> 	<helloString>from Maven!</helloString>
> </configuration>
> {code}
> h1. Issue Reproducer
> Attached I have an example that consists of essentially two parts. On a high level my understanding is that the the publication under the "old" coordinates can have a jar ("01_project_old_coordinates_with_jar"), but doesn't need to have one which would then essentially be a relocation pom ("01_project_old_coordinates_without_jar").
> The project publication with jar allows to see the expected by running
> {code:java}
> cd 01_project_old_coordinates_with_jar
> mvn clean install
> mvn clean package -Pdemo
> {code}
> which outputs {{Hello from Maven!}} (since this is the setting configured in the pom).
> When the relocation is done ("02_project_new_coordinates") and a new version under the new coordinates is published (but one still points to the old configuration) the configuration will not be picked up.
> {code:java}
> cd 02_project_new_coordinates
> # install the SAME version under new coordinates
> mvn clean install
> # run the demo again which still points to the OLD config
> mvn clean package -Pdemo
> {code}
> which output {{Hello World!}}. World is the default encoded in the Mojo, but **not** what was provided to the plugin config!
> This issue can also be observed when the publication under the old coordinates is just a relocation pom.
> h1. Reproducible under
> {code:java}
> $ mvn --version
> Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T21:00:29+02:00)
> Maven home: /usr/share/maven-3.6.1
> Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-oracle
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "5.4.0-77-generic", arch: "amd64", family: "unix"
> {code}
> {code:java}
> $ mvn --version
> Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
> Maven home: /usr/share/maven-3.8.1
> Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-oracle
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "5.4.0-77-generic", arch: "amd64", family: "unix"
> {code}
> Potentially many other versions.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)