Quarkus: Gradle build fails after upgrade to 1.7.2

Created on 3 Sep 2020  路  19Comments  路  Source: quarkusio/quarkus

After upgrade to 1.7.2, all maven projects work just fine, but gradle projects fail with:

Step #0 - "Build and Push Image": > Task :quarkusGenerateCode
Step #0 - "Build and Push Image": preparing quarkus application
Step #0 - "Build and Push Image": kotlin scripting plugin: root project 'my-service'.compileQuarkus-generated-sourcesKotlin - configuration not found: quarkus-generated-sourcesKotlinScriptDef, the plugin is probably applied by a mistake
Step #0 - "Build and Push Image": 
Step #0 - "Build and Push Image": > Task :quarkusGenerateCodeTests FAILED
Step #0 - "Build and Push Image": preparing quarkus application
Step #0 - "Build and Push Image": kotlin scripting plugin: root project 'my-service'.compileQuarkus-test-generated-sourcesKotlin - configuration not found: quarkus-test-generated-sourcesKotlinScriptDef, the plugin is probably applied by a mistake
Step #0 - "Build and Push Image": 
Step #0 - "Build and Push Image": FAILURE: Build failed with an exception.
Step #0 - "Build and Push Image": 
Step #0 - "Build and Push Image": * What went wrong:
Step #0 - "Build and Push Image": Execution failed for task ':quarkusGenerateCodeTests'.
Step #0 - "Build and Push Image": > Failed to generate sources in the QuarkusPrepare task

Any thoughts about why it happened and how to fix that?

aregradle kinbug

Most helpful comment

@gastaldi It works now, thank you!

All 19 comments

/cc @quarkusio/devtools, @glefloch

@parkee do you have a small reproducer? Are you running quarkusBuild or quarkusDev task?

@glefloch
I can create it if needed, but currently, I don't have one.
That's the command I use to build it and it worked with all older versions:
./gradlew clean build -x test -Dquarkus.container-image.push=true -Dquarkus.container-image.tag=$BUILD_ID
We're using quarkus with kotlin if that matters.

I will try to reproduce it with a simple kotlin project I have. Is it a multi module project?

No, it's a simple single module microservice

@glefloch
Well, I just played with it and found that as soon as I remove
implementation 'io.quarkus:quarkus-grpc'
it builds successfully.
So looks like quarkus grpc is that black sheep :D

@glefloch Here's the link to the reproducer
Actually it even works fine with java. So that's the quarkus 1.7.2 + kotlin + gradle + quarkus-grpc combination that breaks our builds.

https://code.quarkus.io/?g=org.acme&a=code-with-quarkus&v=1.0.0-SNAPSHOT&b=GRADLE&c=org.acme.ExampleResource&s=iDg.OxX&cn=code.quarkus.io

I guess it would also be nice to update this post to reflect this specific issue (for other people who decide to upgrade)
https://quarkus.io/blog/quarkus-1-7-2-final-released/

This is what I see with --stacktrace:

Caused by: java.lang.NullPointerException
        at io.quarkus.deployment.CodeGenerator.codeGenOutDir(CodeGenerator.java:99)
        at io.quarkus.deployment.CodeGenerator.lambda$init$0(CodeGenerator.java:49)
        at io.quarkus.deployment.CodeGenerator.callWithClassloader(CodeGenerator.java:65)
        at io.quarkus.deployment.CodeGenerator.init(CodeGenerator.java:38)
        at io.quarkus.deployment.CodeGenerator.initAndRun(CodeGenerator.java:27)
        ... 97 more

@glefloch it seems to be caused by this commit: https://github.com/quarkusio/quarkus/commit/c49e697f4a1dcdbb002cef92ae62cbbfcda92c9f

SourceRegistrar is null because the following block is never reached:

                    if (compileKotlinTask == null) {
                        JavaCompile compileTestJavaTask = (JavaCompile) tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME);
                        compileTestJavaTask.dependsOn(quarkusGenerateCodeTests);
                        quarkusGenerateCodeTests.setSourceRegistrar(compileTestJavaTask::source);
                    }

I guess it would also be nice to update this post to reflect this specific issue (for other people who decide to upgrade)
quarkus.io/blog/quarkus-1-7-2-final-released

If it's a bug in the Gradle plugin only, we can update it directly in the Gradle Plugin portal without requiring a new Quarkus release. Give us some time and we'll have it fixed ASAP.

Thank you !

@parkee the fix was applied and the plugin was updated, can you clear your cache and try again?

@gastaldi Unfortunately still the same.
I tried to remove rm -rf $HOME/.gradle/caches/ locally and I also tried to build it on Cloud Build (it doesn't have any caches and always starts from the clean state).
But I still have the same issue. Any suggestions on what else I need to check?

@parkee for some obscure reason (well, problems in the release script :) ) the uploaded plugin didn't have the fix. Try again now, please (after rm -rf $HOME/.gradle/caches/ locally).

Hold on, it doesn't seem to be there yet, I'll let you know when it's OK

It should be all good now @parkee, sorry for the trouble

@gastaldi It works now, thank you!

I got the very same problem with Quarkus 1.9.2
Source code: https://github.com/guildenstern70/SmartQuark

@guildenstern70 please open a new issue, with the details of the error you obtain and a link to the reproducer you pointed out.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings