Skip to content

quarkus-maven-plugin generate-code-tests fails with some mvn -f paths #51642

@jtnord

Description

@jtnord

Describe the bug

Quarkus 3.21.3 introduced a regression where the quarkus-maven-plugin:generate-code-tests errors for no valid reason.
This fails with the most recent release and was bisected to the above version using a command like the following on a quarkus project.

mvn -ntp --batch-mode -DskipTests -f D:\source\github\myorg\project\bin\..\myquarkusapp clean package -Dquarkus-plugin.version=3.21.2

whilst the path contains .. this is not incorrect, merely unusual and can be constructed by various scripts that use the location of the absolute location of a script to obtain an absolute (but not canonical) location of something (like a quarkus project in this case).

Canonicalizing D:\source\github\myorg\project\bin\..\myquarkusapp to D:\source\github\myorg\project\myquarkusapp and using that as the file source causes the build to pass.

Expected behavior

The build should pass even when given a non canonical location of the file

Actual behavior

the build fails.

> mvn -ntp --batch-mode clean package -DskipTests -f %CD%\..\simple-project -Dquarkus.version=3.21.3
[INFO] Scanning for projects...
[WARNING] The requested profile "nexus3" could not be activated because it does not exist.
[WARNING] The requested profile "may-spotless-apply" could not be activated because it does not exist.
[INFO]
[INFO] ----------------------< io.quarkus:quarkus-51642 >----------------------
[INFO] Building quarkus-51642 0.1-SNAPSHOT
[INFO]   from D:\source\github\quarkus-51642\simple-project\pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ quarkus-51642 ---
[INFO] Deleting D:\source\github\quarkus-51642\simple-project\..\simple-project\target
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ quarkus-51642 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\source\github\quarkus-51642\simple-project\..\simple-project\src\main\resources
[INFO]
[INFO] --- quarkus:3.21.3:generate-code (default) @ quarkus-51642 ---
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ quarkus-51642 ---
[INFO] No sources to compile
[INFO]
[INFO] --- quarkus:3.21.3:generate-code-tests (default) @ quarkus-51642 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.250 s
[INFO] Finished at: 2025-12-18T20:15:34Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.21.3:generate-code-tests (default) on project quarkus-51642: Quarkus code generation phase has failed: Failed to initialize Quarkus Maven context: Failed to load current project at D:\source\github\quarkus-51642\simple-project\pom.xml: Failed to load project D:\source\github\quarkus-51642\simple-project\pom.xml -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

How to Reproduce?

  • mkdir simple-project
  • cd simple-project
  • copy the following contents into pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-51642</artifactId>
  <version>0.1-SNAPSHOT</version>
  <description>https://github.com/quarkusio/quarkus/issues/51642</description>

  <properties>
    <quarkus.version>3.30.4</quarkus.version>
    <quarkus-plugin.version>${quarkus.version}</quarkus-plugin.version>
    <quarkus.platform.version>${quarkus.version}</quarkus.platform.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-universe-bom</artifactId>
        <version>${quarkus.platform.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-maven-plugin</artifactId>
        <version>${quarkus-plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>generate-code</goal>
              <goal>generate-code-tests</goal>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
  • validate the project is valid mvn clean package -DskipTests -f %CD% -Dquarkus.platform.version=3.21.3
  • use an abosolute but non canonical path to attempt to build the project mvn clean package -DskipTests -f %CD%\..\simple-project Dquarkus.platform.version=3.21.3

Output of uname -a or ver

Microsoft Windows [Version 10.0.26200.7462]

Output of java -version

openjdk 17.0.14 2025-01-21 OpenJDK Runtime Environment Temurin-17.0.14+7 (build 17.0.14+7) OpenJDK 64-Bit Server VM Temurin-17.0.14+7 (build 17.0.14+7, mixed mode, sharing)

Quarkus version or git rev

3.21.3 through 3.30.4

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: c:\Java\maven-3.9.9 Java version: 17.0.14, vendor: Eclipse Adoptium, runtime: C:\Java\jdk-17.0.14+7 Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Additional information

the exact same reproducer adatped to linux (mvn -ntp --batch-mode clean package -DskipTests -f $(pwd)/../simple-project -Dquarkus.version=3.21.3) fails on Linux

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae)
Maven home: /home/jnord/.sdkman/candidates/maven/current
Java version: 21.0.8, vendor: Eclipse Adoptium, runtime: /home/jnord/.sdkman/candidates/java/21.0.8-tem
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "6.6.87.2-microsoft-standard-wsl2", arch: "amd64", family: "unix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions