Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.09 KB

build_an_executable_jar_with_both.adoc

File metadata and controls

23 lines (17 loc) · 1.09 KB

You can run the application from the command line with Gradle or Maven. You can also build a single executable JAR file that contains all the necessary dependencies, classes, and resources and run that. Building an executable jar makes it easy to ship, version, and deploy the service as an application throughout the development lifecycle, across different environments, and so forth.

If you use Gradle, you can run the application by using ./gradlew bootRun. Alternatively, you can build the JAR file by using ./gradlew build and then run the JAR file, as follows:

java -jar build/libs/{project_id}-0.1.0.jar

If you use Maven, you can run the application by using ./mvnw spring-boot:run. Alternatively, you can build the JAR file with ./mvnw clean package and then run the JAR file, as follows:

java -jar target/{project_id}-0.1.0.jar
Note
The steps described here create a runnable JAR. You can also build a classic WAR file.