quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.36k stars 2.56k forks source link

Test breaks when using a property in build > directory in pom.xml #41269

Open mhagnumdw opened 2 weeks ago

mhagnumdw commented 2 weeks ago

Describe the bug

In pom.xml, when defining:

<properties>
    <build.output>target</build.output>
</properties>
<build>
    <directory>${build.output}</directory>
</build>

The test breaks: ./mvnw -V clean test

With the exception:

[INFO] Running br.meudominio.meuprojeto.GreetingResourceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.810 s <<< FAILURE! -- in br.meudominio.meuprojeto.GreetingResourceTest
[ERROR] br.meudominio.meuprojeto.GreetingResourceTest.testHelloEndpoint -- Time elapsed: 0.009 s <<< ERROR!
java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for br.meudominio.meuprojeto:my-api2::jar:1.0.0-SNAPSHOTnull
        at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:642)
        at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:726)
        at java.base/java.util.Optional.orElseGet(Optional.java:364)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for br.meudominio.meuprojeto:my-api2::jar:1.0.0-SNAPSHOTnull
        at io.quarkus.bootstrap.BootstrapAppModelFactory.resolveAppModel(BootstrapAppModelFactory.java:308)
        at io.quarkus.bootstrap.app.QuarkusBootstrap.bootstrap(QuarkusBootstrap.java:133)
        at io.quarkus.test.junit.AbstractJvmQuarkusTestExtension.createAugmentor(AbstractJvmQuarkusTestExtension.java:190)
        at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:218)
        at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:609)
        at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:659)
        ... 1 more
Caused by: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to resolve artifact br.meudominio.meuprojeto:my-api2:jar:1.0.0-SNAPSHOT
        at io.quarkus.bootstrap.resolver.BootstrapAppModelResolver.resolve(BootstrapAppModelResolver.java:581)
        at io.quarkus.bootstrap.resolver.BootstrapAppModelResolver.resolve(BootstrapAppModelResolver.java:431)
        at io.quarkus.bootstrap.resolver.BootstrapAppModelResolver.doResolveModel(BootstrapAppModelResolver.java:291)
        at io.quarkus.bootstrap.resolver.BootstrapAppModelResolver.resolveManagedModel(BootstrapAppModelResolver.java:200)
        at io.quarkus.bootstrap.BootstrapAppModelFactory.resolveAppModel(BootstrapAppModelFactory.java:294)
        ... 6 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: br.meudominio.meuprojeto:my-api2:jar:1.0.0-SNAPSHOT (absent): Could not find artifact br.meudominio.meuprojeto:my-api2:jar:1.0.0-SNAPSHOT
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:473)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:261)
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:243)
        at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:278)
        at io.quarkus.bootstrap.resolver.BootstrapAppModelResolver.resolve(BootstrapAppModelResolver.java:576)
        ... 10 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact br.meudominio.meuprojeto:my-api2:jar:1.0.0-SNAPSHOT
        at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:464)
        ... 14 more

Expected behavior

The test should work.

Actual behavior

Throws exception when running the test, as shown above.

How to Reproduce?

No response

Output of uname -a or ver

Linux fedora-desktop 6.0.18-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jan 7 17:08:48 UTC 2023 x86_64 GNU/Linux

Output of java -version

openjdk version "17" 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

Quarkus version or git rev

3.11.1

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

Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: /home/mhagnumdw/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 17, vendor: Oracle Corporation, runtime: /home/mhagnumdw/.asdf/installs/java/openjdk-17 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "6.0.18-200.fc36.x86_64", arch: "amd64", family: "unix"

Additional information

It works ok if you use a hardcoded value instead of a property in <directory>. If you use target or target2 as the value (instead ${build.output}), it will work.

mhagnumdw commented 2 weeks ago

I forgot to comment: note that there is a null at the end of the line: java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for br.meudominio.meuprojeto:my-api2::jar:1.0.0-SNAPSHOTnull