Skip to content

ApacheNoticeResourceTransformer not injecting project name #742

@JackPGreen

Description

@JackPGreen

Affected version

3.6.0

Bug description

When generating a NOTICE using ApacheNoticeResourceTransformer, the project name is not injected (or more likely, resolved) as expected, e.g. the output is:

// ------------------------------------------------------------------
// NOTICE file corresponding to the section 4d of The Apache License,
// Version 2.0, in this case for
// ------------------------------------------------------------------

Not, something like this as you might expect:
https://github.com/apache/amoro/blob/0e34e89dcfc8b5c5b5da285786004965d5b70bc6/NOTICE-binary#L1-L4

Reproducer:
Simple pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="
         http://maven.apache.org/POM/4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.me</groupId>
	<version>0.0.1</version>
	<artifactId>maven-shade-notice-reproducer</artifactId>
    <name>Maven Shade Notice Reproducer</name>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>3.6.0</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<transformers>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
							</transformers>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.18.0</version>
		</dependency>
	</dependencies>
</project>

Windows command to build and print the contents of the NOTICE:
mvn clean package && jar -xf target\maven-shade-notice-reproducer-0.0.1.jar && type META-INF\NOTICE

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions