Skip to content

[MCOMPILER-409] Misconfigured toolchains doesn't halt or error build #618

Open

Description

@jira-importer

John Patrick opened MCOMPILER-409 and commented

Just discovered some circle ci workflows are passing but should have been failing because of misconfiguration. The root cause is a error in the toolchains pointing to an invalid JDK location.

I would expect the compiler/maven to error when validating the toolchains.xml. Instead of silently failing.

[INFO] --- maven-compiler-plugin:3.8.1:compile (CUSTOM_EXECUTION) @ PROJECT ---
[ERROR] Misconfigured toolchain.
org.apache.maven.toolchain.MisconfiguredToolchainException: Non-existing JDK home configuration at /usr/local/openjdk-13
    at org.apache.maven.toolchain.java.JavaToolchainFactory.createToolchain (JavaToolchainFactory.java:109)
    at org.apache.maven.toolchain.DefaultToolchainManager.selectToolchains (DefaultToolchainManager.java:97)
    at org.apache.maven.toolchain.DefaultToolchainManager.getToolchains (DefaultToolchainManager.java:74)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.getToolchain (AbstractCompilerMojo.java:1427)
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:567)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:187)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39)
    at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122)
    at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61)

Affects: 3.8.1

Activity

  1. added
    enhancement
    priority:major
    on Jun 16, 2025
  2. wilx commented on Jul 28, 2026

    @wilx
    Contributor

    The documented way to select and validate a project toolchain is to configure maven-toolchains-plugin:toolchain. The goal is bound to the validate phase and fails before compilation when the required toolchain cannot be created or matched:
    See also https://maven.apache.org/plugins/maven-toolchains-plugin/usage.html

  3. removed
    priority:major
    on Jul 29, 2026
  4. desruisseaux commented on Jul 29, 2026

    @desruisseaux
    Contributor

    I'm not sure to understand this issue. The description said that Maven is silently failing, but there is an exception stack trace. Is it a request to provide a more human-friendly error message? Or does the build continue despite the exception?

  5. wilx commented on Jul 29, 2026

    @wilx
    Contributor

    I misdiagnosed this on first look. It seemed like the toolchains plugin was not being invoked to me.

    On 2nd look, it looks like it is maven-core that eats the exception in org.apache.maven.toolchain.DefaultToolchainManager#selectToolchains.

    Maven 4.x propagates it.

  6. added a commit that references this issue on Jul 29, 2026
    2199ea5
  7. added a commit that references this issue on Aug 29, 2026
    2ba1bbc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions