quarkusio/quarkus · error · GradleException
Malformed URL: + url
Error message
Malformed URL: + url
What it means
toURL(String) converts a registry/endpoint URL string to a java.net.URL. If the string is not a well-formed URL (new URL throws MalformedURLException), it rethrows as GradleException("Malformed URL:" + url). Note the actual message has no space after the colon despite the logged name.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusPlatformTask.java:171
private JavaVersion resolveProjectJavaVersion() {
TaskCollection<JavaCompile> compileTasks = project.getTasks().withType(JavaCompile.class);
if (compileTasks.isEmpty()) {
return JavaVersion.NA;
}
final JavaCompile task = compileTasks.iterator().next();
return new JavaVersion(task.getTargetCompatibility());
}
protected GradleMessageWriter messageWriter() {
return new GradleMessageWriter(getLogger());
}
protected static URL toURL(String url) {
try {
return new URL(url);
} catch (MalformedURLException e) {
throw new GradleException("Malformed URL:" + url, e);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Correct the URL string so it includes a valid scheme, e.g. https://registry.quarkus.io/maven.
- Check for typos/whitespace/quotes in quarkus.registry properties in gradle.properties or environment variables.
- Validate the URL by running new URL(value) in a quick script or curling the endpoint before configuring it.
Example fix
// before (gradle.properties) quarkus.registry=registry.quarkus.io/maven // after quarkus.registry=https://registry.quarkus.io/maven
Defensive patterns
Strategy: validation
Validate before calling
def url = providers.gradleProperty('quarkus.registry').getOrElse('https://registry.quarkus.io')
try { new java.net.URL(url.trim()) } catch (MalformedURLException e) { throw new IllegalArgumentException("Invalid quarkus.registry: " + url) } Type guard
static boolean isValidUrl(String s) {
try { new java.net.URL(s.trim()); return true } catch (MalformedURLException e) { return false }
} Try / catch
try { toURL(registryUrl) } catch (GradleException e) { if (e.message.startsWith('Malformed URL:')) { /* correct scheme in the URL property */ } } Prevention
- Always include the scheme (https://) in registry endpoint properties.
- Trim whitespace and strip quotes when reading URLs from properties/env vars.
- Lint quarkus.registry values in CI with a simple URL parse check.
When it happens
Trigger: Passing a malformed quarkus.registry endpoint (missing scheme, illegal characters, typo like 'http:/host' or 'registry.quarkus.io' without protocol) into tasks that call toURL.
Common situations: Hand-edited registry endpoints in gradle.properties; YAML/property values with stray whitespace or quotes; missing 'https://' scheme; environment-specific overrides with broken values.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to translate ${provider} to URL
- Failed to derive the Maven repository URL for registry ${con
- Failed to initialize Quarkus extension catalog resolver
- No platforms detected in the project
- Mixed DSL is not supported. Both build and settings file nee
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ee0d09f16f91083e.
Report an issue: GitHub.