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

@QuarkusTest in a simple java Gradle project fails: "No builders are available to build a model of type 'io.quarkus.bootstrap.model.ApplicationModel'." #27010

Closed
jskillin-idt opened this issue Jul 28, 2022 · 10 comments
Labels
area/gradle Gradle kind/bug Something isn't working triage/wontfix This will not be worked on

Comments

@jskillin-idt
Copy link
Contributor

Describe the bug

In a Gradle project, a "QuarkusTest" unit test will fail when it is run in a simple "java" or "java-library" project. This is unexpected because these tests work fine in a Maven project. This kind of test is super useful because this allows for fast development cycles at the library level, before waiting for all of these libraries to collaborate in an integration test at the other end of development when a full Quarkus application or extension is finally built.

Expected behavior

Gradle projects should be able to run "QuarkusTest" tests without having to be in a Quarkus-specific project.

Actual behavior

The unit test run fails quickly with the error: No builders are available to build a model of type 'io.quarkus.bootstrap.model.ApplicationModel'. (Full stack trace will be attached.)

How to Reproduce?

  1. Follow the guide to create a new Gradle project.
  2. Run './gradlew test' and note that the tests pass.
  3. Edit the build.gradle file so that the "io.quarkus" plugin is commented out, and the following block is added somewhere: test { useJUnitPlatform() }
  4. Run './gradlew test' and note that the tests fail with the same stacktrace as attached.

Output of uname -a or ver

Linux jacob-ubuntu-dev 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1) OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.11.1.Final

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

Gradle 7.4.2

Additional information

gradle-quarkus-test-stack.txt

@jskillin-idt jskillin-idt added the kind/bug Something isn't working label Jul 28, 2022
@quarkus-bot quarkus-bot bot added the area/gradle Gradle label Jul 28, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 28, 2022

/cc @glefloch, @quarkusio/devtools

@gsmet
Copy link
Member

gsmet commented Jul 28, 2022

Please provide a reproducer project.

@gsmet gsmet added the triage/needs-reproducer We are waiting for a reproducer. label Jul 28, 2022
@jskillin-idt
Copy link
Contributor Author

Please provide a reproducer project.

See: https://github.com/jskillin-idt/quarkusio-quarkus-issues-27010
The latest commit on main reproduces the issue. The initial commit shows the working, default generated project per the guide so you can "diff" and see how step 3 in my reproduction steps affects the project to create the bug.

@geoand geoand removed the triage/needs-reproducer We are waiting for a reproducer. label Jul 29, 2022
@geoand
Copy link
Contributor

geoand commented Jul 29, 2022

I'll let @aloubyansky and @glefloch decide, but in my opinion, this is not something we aim to support. In no place do we say that one can forgo the use of the Quarkus plugin the supported build tools

@glefloch
Copy link
Member

Yes I agree with @geoand, we actually need the plugin test in ordre to detect which dependencies are declared, where are deployment modules, etc.

@geoand
Copy link
Contributor

geoand commented Jul 29, 2022

Thanks @glefloch for the input.

I am going to close this as won't fix

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2022
@geoand geoand added the triage/wontfix This will not be worked on label Jul 29, 2022
@jskillin-idt
Copy link
Contributor Author

jskillin-idt commented Jul 29, 2022

Just to clarify, I've pushed an example Maven version of the same project to this branch in the example repo:
https://github.com/jskillin-idt/quarkusio-quarkus-issues-27010/tree/maven

Is this also considered an invalid configuration? Edit: to be clear, the part I am curious about is the commented-out lines in the pom.xml file in that branch.

If you'd rather not have this discussion in GitHub Issues I have a topic where I initially brought this up in Zulip:
https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Gradle.20Quarkus.20unit.20testing.20for.20libraries/near/291252089

@aloubyansky
Copy link
Member

I think it's reasonable to consider supporting this use-case. @glefloch would you mind taking a look what is in the way here?

@jskillin-idt
Copy link
Contributor Author

Has someone been able to look at the Maven version yet? It's just a generated project from the quarkus CLI, with the Quarkus Maven plugin commented out. Is that usage acceptable?

@devr52
Copy link

devr52 commented Mar 21, 2023

i have the same use case for this, this sample project somehow made it work with a maven project: Designing-Hexagonal-Architecture-with-Java -- having a separate sub-project where it is running test and having a bootstrap project starting quarkus

but I am having the same problem above when using gradle...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working triage/wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

6 participants