Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle cannot resolve plugin versions from the plugin portal that contain a plus character #21366

Open
mstr2 opened this issue Jul 27, 2022 · 0 comments

Comments

@mstr2
Copy link

mstr2 commented Jul 27, 2022

Expected Behavior

I expect Gradle to correctly resolve plugin versions from the plugin portal that contain a + character.

Current Behavior

Consider the following plugin: org.jfxcore.javafxplugin:18-ea+1. Applying the plugin produces the following error message:

> Could not find org.jfxcore:gradle-plugin:18-ea+1.
     Searched in the following locations:
       - https://plugins.gradle.org/m2/org/jfxcore/gradle-plugin/18-ea+1/gradle-plugin-18-ea+1.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project : > org.jfxcore.javafxplugin:org.jfxcore.javafxplugin.gradle.plugin:18-ea+1

The error seems to originate with an attempt by Gradle to incorrectly resolve a URL redirect, which then fails with Resource missing:

[INFO] [org.gradle.internal.resource.transport.http.HttpClientHelper] Resource missing. [HTTP GET: https://plugins-artifacts.gradle.org/org.jfxcore/gradle-plugin/18-ea+1/52bec557dd69672aad080647989c92bb3fe375d33117bd027a9d43a5782ae365/gradle-plugin-18-ea+1.pom]

The underlying reason is the following:
When Gradle tries to resolve the plugin's POM file gradle-plugin-18-ea+1.pom, plugins.gradle.org returns 303 See Other.
The redirected URL of the POM file contains an escaped notation of the plugin version: gradle-plugin-18-ea%2B1.pom (note that + was escaped by %2B).

For reference, this wget call shows what is happening when I'm trying to download the gradle-plugin-18-ea+1.pom file from plugins.gradle.org:

wget https://plugins.gradle.org/m2/org/jfxcore/gradle-plugin/18-ea+1/gradle-plugin-18-ea+1.pom
--2022-07-27 14:31:10--  https://plugins.gradle.org/m2/org/jfxcore/gradle-plugin/18-ea+1/gradle-plugin-18-ea+1.pom
Resolving plugins.gradle.org (plugins.gradle.org)... 104.18.190.9, 104.18.191.9, 2606:4700::6812:be09, ...
Connecting to plugins.gradle.org (plugins.gradle.org)|104.18.190.9|:443... connected.
HTTP request sent, awaiting response... 303 See Other
Location: https://plugins-artifacts.gradle.org/org.jfxcore/gradle-plugin/18-ea%2B1/52bec557dd69672aad080647989c92bb3fe375d33117bd027a9d43a5782ae365/gradle-plugin-18-ea%2B1.pom [following]
--2022-07-27 14:31:10--  https://plugins-artifacts.gradle.org/org.jfxcore/gradle-plugin/18-ea%2B1/52bec557dd69672aad080647989c92bb3fe375d33117bd027a9d43a5782ae365/gradle-plugin-18-ea%2B1.pom
Resolving plugins-artifacts.gradle.org (plugins-artifacts.gradle.org)... 104.18.190.9, 104.18.191.9, 2606:4700::6812:bf09, ...
Connecting to plugins-artifacts.gradle.org (plugins-artifacts.gradle.org)|104.18.190.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1950 (1.9K) [binary/octet-stream]
Saving to: ‘gradle-plugin-18-ea+1.pom’

Note that the repository plugins-artifacts.gradle.org contains the gradle-plugin-18-ea%2B1.pom artifact (where + is escaped), but it does not allow this artifact to be retrieved with an unescaped URL (that contains + instead of %2B).

Yet this is what Gradle seems to be doing, and as a result, it fails to find the artifact.

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

No branches or pull requests

3 participants