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

  1. Correct the URL string so it includes a valid scheme, e.g. https://registry.quarkus.io/maven.
  2. Check for typos/whitespace/quotes in quarkus.registry properties in gradle.properties or environment variables.
  3. 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

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

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/ee0d09f16f91083e. Report an issue: GitHub.