'How to run gradle based spring boot application in background using command line in ubuntu?

I am trying to run gradle based hibernate spring boot application in background thread.



Solution 1:[1]

To run SpringBoot application with ubuntu as background application wia terminal, run below command

gradle clean build  -- TO CLEAN AND BUILD GRADLE APPLICATION
cd TO YOUR BUILD PATH(JAR FILE PATH)
java -jar YOUR_APP_JAR.jar &

Here "&" will assured that when you close your terminal, your application will not kill.

check this for '&' usages in terminal

Solution 2:[2]

you can also run .war files in same way

> gradle clean build
> cd build/libs
> java -jar myApp.war &

Solution 3:[3]

I use below to achieve this for one of the similar requirement.

nohup ./gradlew bootrun >application.log 2>&1 &

Solution 4:[4]

Execute gradle bootRun in project directory if you have not packaged spring boot gradle application into a jar or war

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 ashen madusanka
Solution 3 SRai
Solution 4 Defaulter