Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus Dev mode and Tests does not use effective pom when quarkus.bootstrap.effective-model-builder=true #18980

Closed
garyhodgson opened this issue Jul 24, 2021 · 2 comments
Labels
area/devmode kind/bug Something isn't working

Comments

@garyhodgson
Copy link

Describe the bug

When using the maven-profiledep-extension to compose the pom.xml via profiles, the quarkus tests fail to run. Also, the application fails to start in dev mode.

As the extension results in non-standard pom.xml files it is not unrealistic to expect to have to use the quarkus.bootstrap.effective-model-builder flag - however this appears not to have an effect.

In the provided reproducer the parent pom contains separate profiles for adding maven plugins and dependencies for quarkus, resteasy, and testing. This allows for the standardisation of features used in child projects - particularly when dealing with large multi-module projects across several teams.

Expected behavior

  • When running tests, the tests complete successfully.
  • When starting the application with mvn quarkus:dev, the application starts in dev mode successfully.

Actual behavior

  • mvn test throws the following exception:
[INFO] Running org.acme.getting.started.GreetingResourceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.71 s <<< FAILURE! - in org.acme.getting.started.GreetingResourceTest
[ERROR] org.acme.getting.started.GreetingResourceTest.testHelloEndpoint  Time elapsed: 0 s  <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: The tests were run against a directory that does not contain a Quarkus project. Please ensure that the test is configured to use the proper working directory.
Caused by: java.lang.RuntimeException: The tests were run against a directory that does not contain a Quarkus project. Please ensure that the test is configured to use the proper working directory.
  • mvn quarkus:dev throws the following exception:
2021-07-24 21:08:00,327 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: java.lang.RuntimeException: Failed to load steps from class io.quarkus.deployment.logging.LoggingResourceProcessor
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:413)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:275)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:87)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:448)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:61)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:132)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:89)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)
Caused by: java.lang.RuntimeException: Failed to load steps from class io.quarkus.deployment.logging.LoggingResourceProcessor
        at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:196)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:102)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:411)
        ... 9 more
Caused by: java.lang.IllegalStateException: No root found for class io.quarkus.runtime.logging.LogBuildTimeConfig
        at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadResult.requireRootObjectForClass(BuildTimeConfigurationReader.java:809)
        at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1133)
        at io.quarkus.deployment.ExtensionLoader.loadStepsFromClass(ExtensionLoader.java:623)
        at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:194)
        ... 11 more

How to Reproduce?

Reproducer: https://github.com/garyhodgson/quarkusdev_profiledep_reproducer

Steps:

Test:

(Note that the quarkus.bootstrap.effective-model-builder flag is also set in the surefire configuration within the test profile.)

Dev mode:

  • clone quarkusdev_profiledep_reproducer
  • cd quarkusdev_profiledep_reproducer
  • mvn -Dmaven.test.skip install
  • cd getting-started/
  • mvn -Dquarkus.bootstrap.effective-model-builder=true quarkus:dev

Output of uname -a or ver

CYGWIN_NT-10.0 garyhodgson-PC 3.1.7(0.340/5/3) 2020-08-22 17:48 x86_64 Cygwin

Output of java -version

openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

GraalVM version (if different from Java)

N/A

Quarkus version or git rev

2.0.3.Final

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

Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)

Additional information

  • The application starts fine with java -jar target/quarkus-app/quarkus-run.jar
  • Tests and dev mode work fine when using a flattened pom generated by the flatten-maven-plugin. (However there is also a bug regarding this I will raise in another ticket.)
  • The effective pom appears to contain all the correct elements for tests and dev mode to work correctly. (A copy of the help:effective-pom output is stoed in the reproducer under getting-started/effective-pom.log)

The use of the profiledep extension is an edge case, and so a valid response may be that the flattened pom must be used in both of these cases. The main reason for raising the bug is that the quarkus.bootstrap.effective-model-builder flag appears not to have the expected effect.

@aloubyansky
Copy link
Member

During the test setup the original Maven build context isn't available to the Quarkus bootstrap process it's unfortunately unaware of what the Maven extension did and which profiles should be activated.

@garyhodgson
Copy link
Author

Closing as the expected behaviour is incompatible with the quarkus build model, and was only a "nice to have" feature anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devmode kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants