|
|
@@ -1,60 +0,0 @@
|
|
1
|
|
-//
|
|
2
|
|
-// WARNING: DO NOT EDIT THIS FILE unless you are inside the getting-started-macros repo.
|
|
3
|
|
-// For more information see https://github.com/spring-guides/draft-gs-template/wiki/Pull-in-needed-macros
|
|
4
|
|
-// to see how this macro is used for writing Getting Started guides.
|
|
5
|
|
-//
|
|
6
|
|
-
|
|
7
|
|
-:linkattrs:
|
|
8
|
|
-
|
|
9
|
|
-Now that your `Application` class is ready, you simply instruct the build system to create a single, executable jar containing everything. This makes it easy to ship, version, and deploy the service as an application throughout the development lifecycle, across different environments, and so forth.
|
|
10
|
|
-
|
|
11
|
|
-Below are the Gradle steps, but if you are using Maven, you can find the updated pom.xml https://github.com/spring-guides/{project_id}/blob/master/complete/pom.xml[right here] and build it by typing `mvn clean package`.
|
|
12
|
|
-
|
|
13
|
|
-Update your Gradle `build.gradle` file's `buildscript` section, so that it looks like this:
|
|
14
|
|
-
|
|
15
|
|
-[source,java]
|
|
16
|
|
-----
|
|
17
|
|
-buildscript {
|
|
18
|
|
- repositories {
|
|
19
|
|
- maven { url "http://repo.spring.io/libs-snapshot" }
|
|
20
|
|
- mavenLocal()
|
|
21
|
|
- }
|
|
22
|
|
- dependencies {
|
|
23
|
|
- classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.M6")
|
|
24
|
|
- }
|
|
25
|
|
-}
|
|
26
|
|
-----
|
|
27
|
|
-
|
|
28
|
|
-Further down inside `build.gradle`, add the following to the list of applied plugins:
|
|
29
|
|
-
|
|
30
|
|
-[source,java]
|
|
31
|
|
-apply plugin: 'spring-boot'
|
|
32
|
|
-
|
|
33
|
|
-You can see the final version of `build.gradle` https://github.com/spring-guides/{project_id}/blob/master/complete/build.gradle[right here].
|
|
34
|
|
-
|
|
35
|
|
-The https://github.com/spring-projects/spring-boot/tree/master/spring-boot-tools/spring-boot-gradle-plugin[Spring Boot gradle plugin] collects all the jars on the classpath and builds a single "über-jar", which makes it more convenient to execute and transport your service.
|
|
36
|
|
-It also searches for the `public static void main()` method to flag as a runnable class.
|
|
37
|
|
-
|
|
38
|
|
-Now run the following command to produce a single executable JAR file containing all necessary dependency classes and resources:
|
|
39
|
|
-
|
|
40
|
|
-[subs="attributes", role="has-copy-button"]
|
|
41
|
|
-....
|
|
42
|
|
-$ ./gradlew build
|
|
43
|
|
-....
|
|
44
|
|
-
|
|
45
|
|
-If you are using Gradle, you can run the JAR by typing:
|
|
46
|
|
-
|
|
47
|
|
-[subs="attributes", role="has-copy-button"]
|
|
48
|
|
-....
|
|
49
|
|
-$ java -jar build/libs/{project_id}-0.1.0.jar
|
|
50
|
|
-....
|
|
51
|
|
-
|
|
52
|
|
-If you are using Maven, you can run the JAR by typing:
|
|
53
|
|
-
|
|
54
|
|
-[subs="attributes", role="has-copy-button"]
|
|
55
|
|
-....
|
|
56
|
|
-$ java -jar target/{project_id}-0.1.0.jar
|
|
57
|
|
-....
|
|
58
|
|
-
|
|
59
|
|
-NOTE: The procedure above will create a runnable JAR. You can also opt to link:/guides/gs/convert-jar-to-war/[build a classic WAR file] instead.
|
|
60
|
|
-
|