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
Generate CLI app with correct main class name (was: CLI command stopped working when app is assembled) #474
Comments
@remkop Any ideas on this one? |
Yes, I believe this is because the main class in the Before building the project, open the
Now, when you rebuild the project and start the application, it should work as expected. FYI, there is work in progress to improve this so that the |
Thursday we will do the next release |
ok. I'll hurry. :-) |
Thank you guys! |
First: did that solve the issue? |
Of course. |
Let's leave it open. I will rename this issue and reference it from my PR for creating CLI apps with the correct main class set. |
Oops, I cannot rename it. Anyway, I'll reference it from the PR. |
Just let me know how you want the issue to be named and I'll do that for you. |
How about "Generate CLI app with correct main class name (was: CLI command stopped working when app is assembled)" ? |
Thank you! |
@graemerocher Status update: implementation and testing done; todo: update documentation. I hope to push be able to this tonight. |
@graemerocher it took a while, but please find PR #480 and PR micronaut-projects/micronaut-profiles#59 that address this issue. |
Merged. Thanks |
@graemerocher That was fast! :-) Did you also merge the accompanying micronaut-profiles PR micronaut-projects/micronaut-profiles#59 ? (They need to go together) |
I now see both PRs are merged. Thanks! |
Any solution for same issue but in maven project? My dependencies are the following:
|
@mOo7King Did you generate the app with the |
@mOo7King The user manual has more details: https://docs.micronaut.io/latest/guide/index.html#picocliGenerateProject |
I followed this (http://guides.micronaut.io/creating-your-first-micronaut-app/guide/index.html) guide but instead of generate a Gradle project I created a new project with that maven dependencies I said before. "io.micronaut.runtime.Micronaut start HelloController.java
Application.java
pom.xml
|
@mOo7King Is this still an issue? |
@remkop I decided to generate a Gradle project just like the guide and it worked perfectly. However I need to convert that Gradle project into a Maven one (requirement I need to reach) and as a newbie I don't know how to do that. Any help would be appreciated. |
@mOo7King I missed your earlier comment. I understand a bit better now. I believe you are commenting on the wrong ticket. This ticket is about creating a command line Micronaut application that uses picocli for command line parsing (so the application can have command line options, subcommands etc.) What you are looking to do does not require command line parsing. I am not 100% sure why you are seeing this error
...but it seems that you may be missing a dependency in your POM. That way people who are more expert than me can help out. |
I hate to bring up an old issue, but I am seeing the same problem happen with the What I did on macOS High Sierra (10.13.6) with Azul Zulu JDK 8 (Java 8u162):
The output is:
Checking the pom.xml I see: <properties>
<exec.mainClass>analyzer.Application</exec.mainClass>
<micronaut.version>1.0.0</micronaut.version>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> After changing mainClass to |
I’ll try if I can reproduce the issue. |
I've been able to reproduce the issue: it works for Gradle but is broken for Maven: the main class is |
Looking further, in the The <!-- base/skeleton/maven-build/pom.xml -->
<properties>
<exec.mainClass>@defaultPackage@.Application</exec.mainClass>
<micronaut.version>@version@</micronaut.version>
<jdk.version>@jdkversion@</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> I am guessing that this prevents the definition of the tokens in <!-- cli/skeleton/maven-build/pom.xml : this is not taking effect -->
<properties>
<exec.mainClass>@defaultPackage@.@project.className@Command</exec.mainClass>
</properties> The Still, I'm puzzled, because specifying a different main class does seem to work in @ZacharyKlein any idea what could be happening here? |
Limited internet connectivity at the moment, but I will look into this early next week and get back to you. |
Thanks @jameskleeh ! |
I am currently playing around with the
CLI profile (picocli)
on latest snapshot. The app stopped working when assembled and called viajava -jar …
. Running the app asApplication
from my IntelliJ IDE still works.Steps to Reproduce
cli
enabledExpected Behaviour
CLI command is called and shows
Hi!
Actual Behaviour
CLI command is not invoked instead the message:
INFO io.micronaut.runtime.Micronaut - No embedded container found. Running as CLI application
shows upEnvironment Information
Example Application
n/a
The text was updated successfully, but these errors were encountered: