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

NPE in QuarkusModelBuilder for Gradle composite builds #17367

Closed
symphony-youri opened this issue May 19, 2021 · 3 comments · Fixed by #17394
Closed

NPE in QuarkusModelBuilder for Gradle composite builds #17367

symphony-youri opened this issue May 19, 2021 · 3 comments · Fixed by #17394
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@symphony-youri
Copy link
Contributor

symphony-youri commented May 19, 2021

Describe the bug

On a project using Gradle composite build, dev mode fails to start.
The project layout is the following:

  • composite

    • composite-subproject
  • project

    • utilities
    • my-artifactId
  • my-artifactId depends on utilities

  • utilities depends on composite-subproject

  • project is including composite as a Gradle composite build

Expected behavior

Quarkus dev mode should start.

Actual behavior

Quarkus dev mode fails with:

Caused by: java.lang.NullPointerException
        at io.quarkus.gradle.builder.QuarkusModelBuilder.addDevModePaths(QuarkusModelBuilder.java:402)
        at io.quarkus.gradle.builder.QuarkusModelBuilder.collectDependencies(QuarkusModelBuilder.java:360)
        at io.quarkus.gradle.builder.QuarkusModelBuilder.buildAll(QuarkusModelBuilder.java:112)
        at io.quarkus.gradle.extension.QuarkusPluginExtension.create(QuarkusPluginExtension.java:229)
        at io.quarkus.gradle.extension.QuarkusPluginExtension.getQuarkusModel(QuarkusPluginExtension.java:222)
        at io.quarkus.gradle.extension.QuarkusPluginExtension.getAppModelResolver(QuarkusPluginExtension.java:214)
        at io.quarkus.gradle.tasks.QuarkusDev.newLauncher(QuarkusDev.java:224)
        at io.quarkus.gradle.tasks.QuarkusDev.startDev(QuarkusDev.java:180)
        ... 122 more

Debugging shows that in io.quarkus.gradle.builder.QuarkusModelBuilder#addDevModePaths the project is null when it is referencing the composite module. It looks like with this setup:
IncludedBuild includedBuild = includedBuild(project, a.getName());
fails to detect the composite build.

In my case project.getGradle().includedBuild(projectName) is checking if project project is including composite-subproject where it is including composite.

To Reproduce

Checkout https://github.com/symphony-youri/quarkus-composite

Steps to reproduce the behavior:

  1. Go to project/my-artifactId folder
  2. Run gradle quarkusDev --info --stacktrace

Environment (please complete the following information):

Output of uname -a or ver

Darwin xxx-mbp 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro16,1 Darwin

Output of java -version

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing)

GraalVM version (if different from Java)

Quarkus version or git rev

1.13

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

Gradle 7.0.2

Additional context

(Add any other context about the problem here.)

@symphony-youri symphony-youri added the kind/bug Something isn't working label May 19, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented May 19, 2021

/cc @glefloch, @quarkusio/devtools

@quarkus-bot quarkus-bot bot added the area/gradle Gradle label May 19, 2021
@glefloch
Copy link
Member

Thanks for reporting this. I suspect that we are not using the right project instance as the included build is not a direct dependency of the project.
I will fix this.

@symphony-youri
Copy link
Contributor Author

Thanks for the fix!

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants