Article From:https://www.cnblogs.com/archimedes-euler/p/9967488.html

Jar bags

If you use Maven to manage your project, execute the following commands

cd Items are catalogued (at the same level as pom. xml)
mvn clean package
## Or execute the following commands
## Packaging after excluding test code
mvn clean package  -Dmaven.test.skip=true

After packaging, the jar package will be generated into the target directory. The name is usually project name + version number.jar.

Start the jar package command

java -jar  target/spring-boot-scheduler-1.0.0.jar

In this way, as long as the console is closed, the service cannot be accessed. Next we use the way we run in the background to start:

nohup java -jar target/spring-boot-scheduler-1.0.0.jar &

You can also choose to read different configuration files at startup time

java -jar app.jar –spring.profiles.active=dev

gradle
If gradle is used, pack it with the following command

gradle build
java -jar build/libs/mymodule-0.0.1-SNAPSHOT.jar

Jar bags

If you use Maven to manage your project, execute the following commands

cd Items are catalogued (at the same level as pom. xml)
mvn clean package
## Or execute the following commands
## Packaging after excluding test code
mvn clean package  -Dmaven.test.skip=true

After packaging, the jar package will be generated into the target directory. The name is usually project name + version number.jar.

Start the jar package command

java -jar  target/spring-boot-scheduler-1.0.0.jar

In this way, as long as the console is closed, the service cannot be accessed. Next we use the way we run in the background to start:

nohup java -jar target/spring-boot-scheduler-1.0.0.jar &

You can also choose to read different configuration files at startup time

java -jar app.jar –spring.profiles.active=dev

gradle
If gradle is used, pack it with the following command

gradle build
java -jar build/libs/mymodule-0.0.1-SNAPSHOT.jar

Link of this Article: Java packing

Leave a Reply

Your email address will not be published. Required fields are marked *