[ https://issues.apache.org/jira/browse/MDEP-955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17888900#comment-17888900 ]
Elliotte Rusty Harold commented on MDEP-955: -------------------------------------------- Good analysis. Thanks. Looksm like we should also remove setFileMappers and getFileMappers from Artifactitem > unpack ignores global fileMappers > --------------------------------- > > Key: MDEP-955 > URL: https://issues.apache.org/jira/browse/MDEP-955 > Project: Maven Dependency Plugin > Issue Type: Bug > Components: unpack > Affects Versions: 3.8.0 > Environment: Windows 11, Java 21, Maven 3.8.6, Maven Dependency > Plugin 3.8.0 > Reporter: Jonah Bauer > Priority: Major > > I was trying to use the {{unpack}} goal to unpack multiple artifacts with a > similar structure (namely webjars) and rewrite their filenames using a common > file mapper. The {{unpack}} goal conveniently defines the property > {{fileMappers}} which seems suited for this use case. The configuration is as > follows > {code:xml} > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-dependency-plugin</artifactId> > <version>3.8.0</version> > <executions> > <execution> > <id>unpack-libraries</id> > <phase>generate-resources</phase> > <goals> > <goal>unpack</goal> > </goals> > <configuration> > <artifactItems> > <artifactItem> > <groupId>org.webjars.npm</groupId> > <artifactId>chart.js</artifactId> > <version>${chartjs.version}</version> > </artifactItem> > <artifactItem> > <groupId>org.webjars.npm</groupId> > <artifactId>chartjs-adapter-date-fns</artifactId> > <version>3.0.0</version> > </artifactItem> > </artifactItems> > <includes>META-INF/resources/webjars/*/*/dist/**</includes> > > <outputDirectory>${project.build.directory}/generated-resources/libraries</outputDirectory> > <fileMappers> > > <org.codehaus.plexus.components.io.filemappers.RegExpFileMapper> > > <pattern>^META-INF/resources/webjars/([^/]+)/[^/]+/dist/</pattern> > <replacement>./$1/</replacement> > > </org.codehaus.plexus.components.io.filemappers.RegExpFileMapper> > </fileMappers> > </configuration> > </execution> > </executions> > </plugin> > {code} > This, however, does not work. While the artifacts are unpacked to the target > directory, the globally configured {{fileMappers}} did not seem to take any > effect. > After looking into the code of {{UnpackMojo}} it seems the > {{UnpackMojo::getFileMappers}} method is unused. In > {{UnpackMojo::getProcessedArtifactItems}} the {{includes}} and {{excludes}} > of each artifact item are set to the globally configured values if empty, but > the file mappers are left unchanged. -- This message was sent by Atlassian Jira (v8.20.10#820010)