quarkus dev mode for CLI, how to restart app - java

I just created a sample Quarkus CLI app. When I run it in dev mode, pressing [enter] does not restart the application.
Steps to reproduce:
I am using the quarkus CLI, on macOS Big Sur, default Terminal app. I generate a default cli app with the following command:
quarkus create cli --group-id=test --artifact-id=test --maven --java --code
Then, once I am inside the test folder, I run:
quarkus dev
The example code runs and dev mode stays waiting for changes, but if I update the sample code and press [enter] on the terminal as described in the quarkus guide for CLI apps, the app is not rerun.
I also tried maven directly as suggested on the guide:
mvn compile quarkus:dev
But the result is the same.
The example generated is very simple, and uses Quarkus 2.0.1 with the picocli extension. Works fine when compiled and run standalone.
Does anyone know what am I missing?
Thanks for any suggestions.

I think what you are seeing is a bug in 2.0 cli where create cli does not create a cli but just the standard app. Thus it won't reload until you hit localhost:8080.
it will be fixed in next version. sorry for inconvenience.
In the mean time you can use https://quarkus.io/guides/command-mode-reference which explains the minimal code and dependencies needed for a Quarkus cli.

Does your project have any tests? The picocli project created by the cli doesn't by default (yet?).
https://github.com/quarkusio/quarkus/pull/18700 should fix your issue (behavior of dev mode for projects without tests).

Related

VSCode for Java on FreeBSD

After installing the Java Extension Pack, Spring Boot Extension Pack, and Lombok, I created a basic Spring Boot project just to test out VSCode (I followed the Spring Boot initializer which works surprisingly well).
I attempted to run the application (barebones / skeleton project) and when clicking on the "Play" button and selecting "Run Java", the Run dialog hangs indefinitely.
I can run the project from the command line, using maven to compile it followed by java -jar; however, I want to be able to do everything in VSCode including running and debugging.
I clicked on "check details", but there isn't any information for me to go by and make an educated guess as to what is going on.
EDIT:
Just to be clear, I am running VSCode on FreeBSD (which is not Linux).
you can have a look on this extension whitch look like Boot Dashboard in Eclipse and it enable you to manage your application and have a control above it andu can run multiple projects using it in this Link.
Note: i think it need java 11 to work
Here is a description of how to use springboot. You can refer to it to see if there is a problem with any operation.
https://code.visualstudio.com/docs/java/java-spring-boot

Run intellij plugin from cli in Windows 10

I'm developing a plugin that analyzes source code in a project. Now I need to run it on a great number of projects, so I decided to automate the process. Looking for a way to achieve this I found that I need to implement ApplicationStarter interface and declaring it as extension point in appStart category, as described here:
Intellij - how to make a plugin that can perform IDE actions via a CLI or web service?
Although, I was not able to execute my custom command. When I run
idea64 mycommand
a loading screen of intellij starts and then nothinng happens. I have to kill the process via task manager. My version Is 2020 on Windows 10.
I'm writing here too as on jetbrains I've received no answers yet.
Is there something i'm missing? Thank you in advance.

Developing Java (Maven) application on Docker container

For a new Spring project I'd like to setup a Docker container to build + run + debug my application.
At the moment I'm using this Dockerfile:
FROM maven:3.6.2-jdk-8-slim
COPY . /app/
WORKDIR /app/
RUN mvn clean package
FROM maven:3.6.2-jdk-8-slim
COPY target/app.jar app.jar
ENTRYPOINT ["java","-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005", "-jar","/app.jar"]
EXPOSE 5005
In the first step the project is built. In the second step the application is run exposing a 5005 port for "remote" debugging.
Then from my IDE (IntelliJ IDEA) I'm configuring a remote debugging configuration to execute debug on the container.
As you may guess is a bit awkward to execute these steps for every little edit I'd like to debug in the project.
So, I'm wondering if there's a more practical approach using IntelliJ to automatically build and attach the debugger to my application just like when developing directly on my dev machine...
First of all, you can open a pom.xml right from IntelliJ and run the application without the need to run maven (IntelliJ has an excellent maven plugin).
Since you're running it as a java -jar you don't even need an ultimate version of IntelliJ.
Now this is how we develop usually, even before maven. You can run mvn clean package locally as well if you want to, say, check that the tests are run (again, you can also do that in Idea). And when you push your changes create a docker and deploy on server.
This is by far the best solution I can recommend. The way you've described in the question suites more to debugging the remote servers (read ready environments).
If you absolutely need this way, you still can use HotSwap feature of JVM for small changes (as longs as these changes are inside the method): While connected via Remote Debugger, right click and "Recompile" the class that has a change. It will be automatically loaded to remote JVM so that you don't actually need to trigger all this process.
You also don't have to run all the tests in maven (mvn clean package -Dmaven.tests.skip)
A couple of ideas that you can implement:
Use CI/CD to build your docker images
Instead of offloading this work to docker files, let your CI/CD pipeline to build your artifact and then pack it into a docker image ( you'll have more control over the process ). Finally, you can also deploy it to a targeted environment.
Use IntelliJ to run and debug your project on the DEV machine
You gain almost no benefit by running your project using Docker on your DEV machine, only a lot of hassle.

Rapid Application Development in Eclipse Alfresco (Hot Reloading)

I want to make changes in the SendAsEmailActionExecuter.java file in the sub-project AMP (add-action-repo) which is inside All-in-one project in Alfresco 5 community. It is an example as you can see in the following link. I am developing in eclipse and when I customize an ftl or js file the eclipse the eclipse reload the changes. How can achieve the same thing with java file without the need to execute clean install -Prun command every time.
I have notice this guide but the DemoComponentTest does not make the trick.
How can achieve hot reloading in a such case ?
The Rapid Application Development (RAD) in Alfresco SDK is delivered by the spring loaded library.
Long story short, you need to run your project using the shipped OOTB run.sh / run.bat depending on your OS.
The run script will check if the spring-loaded jar is already present in your repo, run profile setup if it is not present to go fetch it, and then run mvn integration-test -Prun or mvn install -Prun, I do not remember which is called on the script but it should be one of those two
UPDATE :
Please refer to this file for further reference
Please note that RAD is not available in SDK-2.2 as it is not compatible with it and would prevent the repo from starting
SDK 2.2 is only available for alfresco 5.1.x code base (and it is the only viable option for developing 5.1.x extensions)

Which java server to run a jar application?

I made a java program which runs unit test on my website.
I need the unit test to keep running during the day while I watch the log.
For this, I search a java platform on which I can run my soft. Openshift will be the best because it's easy to install and maintain.
However I will often modify this soft and if the java project could be built whenever I made a commit it will be the best. That's why I think to Jenkins, but I don't know if it is a good way to run a jar from a jenkins server whereas it is made to do build.
I tried JBoss and tomcat by wrapping my programs into an Enterprise Application Client but I can not run and check the log of the program from a web interface.
Currently my project is a Java Application, using MySQL, hibernate, maven and git.
What would be the best option for you ?
Thanks.
Florian C.
Finally, here is my soluce.
I use Jenkins.
When I push on Jenkins, my project is automatically built and ran using a shell script.
If the build or the run fails Jenkins sends me the command output by mail.
Else, every day, the project is run (using the cron of jenkins) and the console output is sent to me by mail, so I can check the result of my test.

Categories