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

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

Closed
bboyz269 opened this issue Dec 23, 2022 · 2 comments · Fixed by #30058
Closed
Labels
area/kotlin kind/bug Something isn't working
Milestone

Comments

@bboyz269
Copy link

Describe the bug

Pretty sure it's from this pull #29755.
sanitizeMainClassName method overlooks that main class extends from QuarkusApplication still compiled as original name (no postfix Kt)

private static String sanitizeMainClassName(ClassInfo mainClass) {
String className = mainClass.name().toString();
if (isKotlinClass(mainClass)) {
MethodInfo mainMethod = mainClass.method("main",
ArrayType.create(Type.create(DotName.createSimple(String.class.getName()), Type.Kind.CLASS), 1));
if (mainMethod == null) {
className += "Kt";
}
}
return className;
}


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

@bboyz269 bboyz269 added the kind/bug Something isn't working label Dec 23, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 23, 2022

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

@geoand
Copy link
Contributor

geoand commented Dec 23, 2022 via email

geoand added a commit to geoand/quarkus that referenced this issue Dec 23, 2022
geoand added a commit that referenced this issue Dec 24, 2022
Ensure that Kotlin subclass of QuarkusApplication works properly
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Dec 24, 2022
@gsmet gsmet modified the milestones: 2.16 - main, 2.15.2.Final Jan 3, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 3, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 4, 2023
ebullient pushed a commit to maxandersen/quarkus that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kotlin kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants