Skip to content

Do not take the URL of a model in a JAR for a file path in plugin validation messages (fix #10719) - #13576

Closed
arturobernalg wants to merge 1 commit into
apache:maven-3.10.xfrom
arturobernalg:fix/maven-10719-plugin-declaration-3.10
Closed

arturobernalg wants to merge 1 commit into
apache:maven-3.10.xfrom
arturobernalg:fix/maven-10719-plugin-declaration-3.10

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

What and why

DefaultPluginValidationManager#pluginDeclaration prints where a plugin is declared. The location of the super POM is the URL of a resource in a JAR, for instance jar:file:/C:/maven/lib/maven-model-builder.jar!/org/apache/maven/model/pom-4.0.0.xml. The existing check only treats a location as a URL when it contains ://, which this one does not, so it was converted to a file path to be printed relative to the project. On Windows that throws an InvalidPathException (illegal :), and the build fails instead of printing the validation warning, as reported for the release-profile of the super POM (#10719).

How

A location with a URL scheme is printed as it is. A new isUrl helper recognises a scheme of at least two characters, so that the drive of a Windows path such as C:\\proj\\pom.xml is not taken for one.

Tests

DefaultPluginValidationManagerTest covers URL and file path locations, including Windows paths. maven-core passes (422 tests) and spotless is clean. I did not reproduce the exception end to end, because it only happens on Windows, and I did not run the integration tests.

This is 3.10.x only. Maven 4 no longer has a release-profile in the super POM.


To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
check one of the following:

…g plugin validation issues (fix apache#10719)

The location of the super POM is the URL of a resource in a JAR, such as jar:file:/C:/maven/lib/maven-model-builder.jar!/org/apache/maven/model/pom-4.0.0.xml. It has no ://, so it was converted to a file path to print it relative to the project, which fails on Windows with an InvalidPathException and fails the build instead of printing the warning, for instance with the release-profile of the super POM.

Fixes apache#10719
@slawekjaranowski

Copy link
Copy Markdown
Member

This is 3.10.x only. Maven 4 no longer has a release-profile in the super POM.

release-profile in the super POM is also removed from 3.10.x

@arturobernalg

Copy link
Copy Markdown
Member Author

Thanks. I checked the super POM of 3.10.x: after #11999 it has no profiles and no plugins, so the release-profile that triggered #10719 is gone, and I could not find another plugin declaration whose location is a JAR URL. Without a remaining trigger this change is not needed on this branch, so I am closing it. I will say so on #10719.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants