You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (Jira)" <ji...@apache.org> on 2021/12/25 16:03:00 UTC

[jira] [Comment Edited] (MNG-5561) Plugin relocation loses configuration

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

Michael Osipov edited comment on MNG-5561 at 12/25/21, 4:02 PM:
----------------------------------------------------------------

I have now created now a  PR for which fixes the issue for me. What I don't know for sure whether we can completely rely on {{Plugin}} or need to fiddle with {{MojoExecution}} first and then try {{Plugin}}.
{{MojoExecution}} represents full dynamic resolution *after* relocation, so it already represents the new plugin without any connection to the old one while {{Plugin}} contains the old plugin referenced in the POM. Obviously, the new plugin is *not* configured in the POM, but only the old one. I think that we need to read out the static one from POM to find config. This won't matter for plugins which haven't been relocated, but makes complete difference for relocated ones.

[~cstamas], [~jvanzyl], [~rfscholte], opinions? I will try to work on an IT as well.


was (Author: michael-o):
I have now created now a  PR for which fixes the issue for me. What I don't know for sure whether we can completely rely on {{Plugin}} or need to fiddle with {{MojoExecution}} first and then try {{Plugin}}.
{{MojoExecution}} represents full dynamic resolution *after* relocation, so it already represents the new plugin without any connection to the old one while {{Plugin}} contains the old plugin referenced in the POM. Obviously, the new plugin is 

> Plugin relocation loses configuration
> -------------------------------------
>
>                 Key: MNG-5561
>                 URL: https://issues.apache.org/jira/browse/MNG-5561
>             Project: Maven
>          Issue Type: Bug
>          Components: Plugins and Lifecycle
>    Affects Versions: 3.1.1
>            Reporter: Julien CARSIQUE
>            Assignee: Michael Osipov
>            Priority: Major
>         Attachments: screenshot-1.png
>
>
> Hi,
> Applying a relocation on a plugin seems to lose its configuration. 
> In the following sample, I relocated "nuxeo-distribution-tools" to "ant-assembly-maven-plugin" and the missing configured parameter is "buildFile". The relocation itself went well but the execution fails because of a missing parameter.
> {code:title=~/.m2/repository/org/nuxeo/build/nuxeo-distribution-tools/2.0-SNAPSHOT/nuxeo-distribution-tools-2.0-SNAPSHOT.pom}
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
>   <modelVersion>4.0.0</modelVersion>
>   <groupId>org.nuxeo.build</groupId>
>   <artifactId>nuxeo-distribution-tools</artifactId>
>   <version>2.0-SNAPSHOT</version>
>   <packaging>maven-plugin</packaging>
>   <name>Nuxeo Distribution Build</name>
>   <description>Assemble Nuxeo distributions</description>
>   <distributionManagement>
>     <relocation>
>       <artifactId>ant-assembly-maven-plugin</artifactId>
>     </relocation>
>   </distributionManagement>
> </project>{code}
> {code:title=executed POM extract}
>   <build>
>     <plugins>
>       <plugin>
>         <groupId>org.nuxeo.build</groupId>
>         <!-- With relocation -->
>         <artifactId>nuxeo-distribution-tools</artifactId>
>         <!-- Without relocation -->
>         <!-- <artifactId>ant-assembly-maven-plugin</artifactId> -->
>         <executions>
>           <execution>
>             <id>assemble</id>
>             <phase>package</phase>
>             <configuration>
>               <!-- The missing parameter in case of relocation -->
>               <buildFile>src/main/assemble/assembly.xml</buildFile>
>             </configuration>
>             <goals>
>               <goal>build</goal>
>             </goals>
>           </execution>
>         </executions>
>       </plugin>
>     </plugins>
>   </build>
> {code}
> Here is the diff between an "mvn package -X" with nuxeo-distribution-tools (ie: with relocation; line starting with "<") and another one with ant-assembly-maven-plugin (ie: without relocation; line starting with ">"):
> {noformat}< [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=72, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=34, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=1, ConflictResolver.conflictItemCount=71, DefaultDependencyCollector.collectTime=10, DefaultDependencyCollector.transformTime=2}
> > [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=72, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=34, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=71, DefaultDependencyCollector.collectTime=65, DefaultDependencyCollector.transformTime=3}
> ---
> < [DEBUG] Created new class realm plugin>org.nuxeo.build:nuxeo-distribution-tools:2.0-SNAPSHOT
> < [DEBUG] Importing foreign packages into class realm plugin>org.nuxeo.build:nuxeo-distribution-tools:2.0-SNAPSHOT
> > [DEBUG] Created new class realm plugin>org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT
> > [DEBUG] Importing foreign packages into class realm plugin>org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT
> ---
> < [DEBUG] Populating class realm plugin>org.nuxeo.build:nuxeo-distribution-tools:2.0-SNAPSHOT
> > [DEBUG] Populating class realm plugin>org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT
> ---
> < [DEBUG] Configuring mojo org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT:build from plugin realm ClassRealm[plugin>org.nuxeo.build:nuxeo-distribution-tools:2.0-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@591ce4fe]
> > [DEBUG] Configuring mojo org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT:build from plugin realm ClassRealm[plugin>org.nuxeo.build:ant-assembly-maven-plugin:2.0-SNAPSHOT, parent: sun.misc.Launcher$AppClassLoader@77fe0d66]
> ---
> > [DEBUG]   (f) buildFile = /home/julien/ws-ssd/nuxeo/nuxeo-distribution/nuxeo-distribution-resources/src/main/assemble/assembly.xml{noformat}
> The last line highlights the missing parameter.
> Indeed, it seems that in case of a relocation, all the "Parameter" Mojo fields take their default value (or none) whereas the "Component" fields are still properly injected.



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