-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Kotlin QuarkusMain native build does not work #29754
Comments
/cc @evanchooly, @geoand |
Thanks for reporting. #29755 fixes the issue |
That was fast. |
👍 |
Does this work in JVM mode? because |
Hello @evanchooly , the problem exists also in the normal run mode. you can't start.
@geoand : Does your commit fix this problem also? Or should I open a new bug report? |
That's precisely my point. This In short, this is not a quarkus bug and should not be fixed in quarkus. This is a function of how kotlin works and thus not a bug at all but a misunderstanding how where elements live and how to annotate them properly. |
My PR should address all cases
…On Fri, Dec 9, 2022 at 2:59 AM Justin Lee ***@***.***> wrote:
That's precisely my point. This main() doesn't exist on
GreetingApplication. At best it exists on GreetingApplicationKt becaue
the main() is a top level function. If you want this precise source to
work try updating your annotation like so: @file:QuarkusMain. That will
apply the annotation to the file and thus, potentially, the
GreetingApplicationKt class synthesized to hold your top level function.
In short, this is not a quarkus bug and should not be fixed in quarkus.
This is a function of how kotlin works and thus not a bug at all but a
misunderstanding how where elements live and how to annotate them properly.
—
Reply to this email directly, view it on GitHub
<#29754 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBMDP4WPTO7TITVPMJ3PHLWMJ75NANCNFSM6AAAAAASX7MURA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@evanchooly I don't agree that this should not be fixed. Users expect to do something like: @SpringBootApplication
class DemoApplication
fun main(args: Array<String>) {
runApplication<DemoApplication>(*args)
} because that's how they are told to do it in Spring Boot. |
Thanks for clarification |
If that's how Spring does it then perhaps being consistent with that has its merits. Spring made the wrong choice there, IMO, as this changes the semantics of the language. |
Fix combination of @QuarkusMain and Kotlin native application
Fixes: quarkusio#29754 (cherry picked from commit 2846cd2)
Describe the bug
Hello,
I have a main application class and want to compile everything in native mode.
Main Class
during initializing phase it breaks with the following exception:
Expected behavior
native build works also with a kotlin main class
Actual behavior
Build breaks during Initialization Phase with this error message:
[1/7] Initializing... (0.0s @ 0.15GB)
Error: Method 'com.github.GreetingApplication.main' is declared as the main entry point but it can not be found. Make sure that class 'com.github.GreetingApplication' is on the classpath and that method 'main(String[])' exists in that class.
com.oracle.svm.core.util.UserError$UserException: Method 'com.github.GreetingApplication.main' is declared as the main entry point but it can not be found. Make sure that class 'com.github.GreetingApplication' is on the classpath and that method 'main(String[])' exists in that class.
How to Reproduce?
./gradlew build -Dquarkus.package.type=native
Output of
uname -a
orver
Linux fedora 6.0.11-300.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Dec 2 20:47:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.14.3.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)Gradle 7.5.1
Additional information
No response
The text was updated successfully, but these errors were encountered: