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

[jira] [Commented] (MNG-7349) Superfluous relocation warning messages

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

Joep Weijers commented on MNG-7349:
-----------------------------------

I also found that you can not solve this message in the case a dependency has a transitive dependency on a relocated artifact. Taking for example {{com.lowagie:itext-rtf:2.1.7}}, which depends on {{bouncycastle:bctsp-jdk14:jar:138}}:
{code:java}
	<dependencies>
		<dependency>
			<groupId>com.lowagie</groupId>
			<artifactId>itext-rtf</artifactId>
			<version>2.1.7</version>
		</dependency>
	</dependencies>
{code}
{{mvn dependency:tree}} shows the warning:
{code:java}
[WARNING] The artifact bouncycastle:bctsp-jdk14:jar:138 has been relocated to org.bouncycastle:bctsp-jdk14:jar:1.38
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ relocation-messages ---
[INFO] com.topdesk.maven.test:relocation-messages:jar:0.0.1-SNAPSHOT
[INFO] \- com.lowagie:itext-rtf:jar:2.1.7:compile
[INFO]    +- bouncycastle:bcmail-jdk14:jar:138:compile
[INFO]    +- bouncycastle:bcprov-jdk14:jar:138:compile
[INFO]    \- org.bouncycastle:bctsp-jdk14:jar:1.38:compile
[INFO]       +- org.bouncycastle:bcprov-jdk14:jar:1.38:compile
[INFO]       \- org.bouncycastle:bcmail-jdk14:jar:1.38:compile
{code}
Now if I exclude these transitive dependency:
{code:java}
	<dependencies>
		<dependency>
			<groupId>com.lowagie</groupId>
			<artifactId>itext-rtf</artifactId>
			<version>2.1.7</version>
			<exclusions>
				<exclusion>
					<groupId>bouncycastle</groupId>
					<artifactId>bcprov-jdk14</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.bouncycastle</groupId>
					<artifactId>bctsp-jdk14</artifactId>
				</exclusion>
				<exclusion>
					<groupId>bouncycastle</groupId>
					<artifactId>bcmail-jdk14</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>
{code}
{{mvn dependency:tree}} still shows the warning, even though the dependencies are indeed excluded:
{code:java}
[WARNING] The artifact bouncycastle:bctsp-jdk14:jar:138 has been relocated to org.bouncycastle:bctsp-jdk14:jar:1.38
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ relocation-messages ---
[INFO] com.topdesk.maven.test:relocation-messages:jar:0.0.1-SNAPSHOT
[INFO] \- com.lowagie:itext-rtf:jar:2.1.7:compile
{code}
Also in this case I would not expect the warning message to show up.

As a workaround I tried to manage the dependency, but alas, the warning still shows, even though we are no longer using that particular version:
{code:java}
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.bouncycastle</groupId>
				<artifactId>bctsp-jdk14</artifactId>
				<version>1.46</version>
			</dependency>
		</dependencies>
	</dependencyManagement>
	
	<dependencies>
		<dependency>
			<groupId>com.lowagie</groupId>
			<artifactId>itext-rtf</artifactId>
			<version>2.1.7</version>
			<exclusions>
				<exclusion>
					<groupId>bouncycastle</groupId>
					<artifactId>bcprov-jdk14</artifactId>
				</exclusion>
				<exclusion>
					<groupId>bouncycastle</groupId>
					<artifactId>bcmail-jdk14</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
	</dependencies>
{code}
{{{}mvn dependency:tree{}}}:
{code:java}
[WARNING] The artifact bouncycastle:bctsp-jdk14:jar:138 has been relocated to org.bouncycastle:bctsp-jdk14:jar:1.38
[INFO]
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ relocation-messages ---
[INFO] com.topdesk.maven.test:relocation-messages:jar:0.0.1-SNAPSHOT
[INFO] \- com.lowagie:itext-rtf:jar:2.1.7:compile
[INFO]    \- org.bouncycastle:bctsp-jdk14:jar:1.46:compile
[INFO]       +- org.bouncycastle:bcprov-jdk14:jar:1.46:compile
[INFO]       \- org.bouncycastle:bcmail-jdk14:jar:1.46:compile
{code}

> Superfluous relocation warning messages 
> ----------------------------------------
>
>                 Key: MNG-7349
>                 URL: https://issues.apache.org/jira/browse/MNG-7349
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.8.3, 3.8.4
>            Reporter: Joep Weijers
>            Priority: Minor
>
> In the [commit|https://github.com/apache/maven/commit/a1ba33069fad1fb9c6e9cd458ad233ff3a74aadd] that solved MNG-7253, the check for relocations was moved from the DefaultProjectDependenciesResolver to the DefaultArtifactDescriptorReader. This means that the relocation messages are not only shown on project dependencies, but on any artifact that is read.
> This may lead to unfixable WARNINGS in the output if a plugin transitively uses a relocated artifact.
> This can be reproduced by calling {{mvn dependency:tree}} with a simple, empty {{{}pom.xml{}}}. This will give the following warning:
> {code:java}
> [WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
> {code}
> The default maven-dependency-plugin version is 2.8 and it depends on {{{}org.apache.maven.reporting:maven-reporting-impl:2.0.5{}}}, which depends on {{commons-validator:commons-validator:1.2.0}} which depends on {{{}xml-apis:xml-apis:2.0.2{}}}.
> In this particular case, updating to a recent maven-dependency-plugin version solves the issue. But since the transitive dependencies of plugins are not under the control of the end users, I don't think this warning should be shown.
> *Workaround:*
> Stay on Maven 3.8.2 or disable logging on the DefaultArtifactDescriptorReader:
> {code:java}
> -Dorg.slf4j.simpleLogger.log.org.apache.maven.repository.internal.DefaultArtifactDescriptorReader=error
> {code}
> Although this disables all relocation messages, including the ones you might be interested in.



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