quarkusio / quarkus

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

2.15.1.Final breaks command mode with main class extends from `QuarkusApplication` in kotlin #30054

Closed bboyz269 closed 1 year ago

bboyz269 commented 1 year ago

Describe the bug

Pretty sure it's from this pull https://github.com/quarkusio/quarkus/pull/29755. sanitizeMainClassName method overlooks that main class extends from QuarkusApplication still compiled as original name (no postfix Kt) https://github.com/quarkusio/quarkus/blob/6776f0deeb8537c5207ddb5ad08e7b3c5db83722/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java#L416-L427


With

@QuarkusMain(name = "my-main")
class MyMainClass : QuarkusApplication {
  override fun run(vararg args: String?): Int {
    // omitted
  }
}

Running

./gradlew quarkusDev -Dquarkus.package.main-class=my-main

would produces following error

Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#mainClassBuildStep threw an exception: java.lang.IllegalArgumentException: The supplied 'main-class' value of '...MyMainClassKt' does not correspond to either a fully qualified class name or a matching 'name' field of one of the '@QuarkusMain' annotations

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

quarkus-bot[bot] commented 1 year ago

/cc @evanchooly(kotlin), @geoand(kotlin)

geoand commented 1 year ago

You are right, we need to cover that case

On Fri, Dec 23, 2022, 13:07 quarkus-bot[bot] @.***> wrote:

/cc @evanchooly https://github.com/evanchooly(kotlin), @geoand https://github.com/geoand(kotlin)

— Reply to this email directly, view it on GitHub https://github.com/quarkusio/quarkus/issues/30054#issuecomment-1363857190, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBMDP5SGKXAPKW2DA4XDGDWOWBY7ANCNFSM6AAAAAATHUEPAU . You are receiving this because you were mentioned.Message ID: @.***>