Skip to content

[MNG-5561] Plugin relocation loses configuration #6777

@jira-importer

Description

@jira-importer

Julien CARSIQUE opened MNG-5561 and commented

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.

<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>
<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>

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 ">"):

< [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}
&mdash;
< [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
&mdash;
< [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
&mdash;
< [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]
&mdash;
> [DEBUG]   (f) buildFile = /home/julien/ws-ssd/nuxeo/nuxeo-distribution/nuxeo-distribution-resources/src/main/assemble/assembly.xml

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.


Affects: 3.1.1

Attachments:

Issue Links:

  • MNG-7204 Maven might pick up the wrong configuration when the plugin happens to include relocation information
    ("is duplicated by")
  • MNG-7374 Mutating RelocatedArtifact does not retain type

Remote Links:

Backported to: 4.0.0-alpha-2, 3.8.5

3 votes, 7 watchers

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority:majorMajor loss of function

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions