Преглед на файлове

Merge branch 'master' of github.com:spring-guides/getting-started-macros

Greg Turnquist преди 13 години
родител
ревизия
86e42d416b

+ 6
- 0
macros/bootstrap_starter_pom_disclaimer.asc Целия файл

@@ -0,0 +1,6 @@
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
+NOTE: This guide is using link:/guides/gs/spring-boot[Spring Boot].

+ 6
- 0
macros/build_an_executable_jar_subhead.asc Целия файл

@@ -0,0 +1,6 @@
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
+=== Build an executable JAR

+ 59
- 0
macros/build_an_executable_jar_with_both.asc Целия файл

@@ -0,0 +1,59 @@
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
+:linkattrs:
7
+
8
+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.
9
+
10
+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`.
11
+
12
+Update your Gradle `build.gradle` file's `buildscript` section, so that it looks like this:
13
+
14
+[source,java]
15
+----
16
+buildscript {
17
+    repositories {
18
+        maven { url "http://repo.spring.io/libs-snapshot" }
19
+        mavenLocal()
20
+    }
21
+    dependencies {
22
+        classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.M4")
23
+    }
24
+}
25
+----
26
+
27
+Further down inside `build.gradle`, add the following to the list of applied plugins:
28
+
29
+[source,java]
30
+apply plugin: 'spring-boot'
31
+
32
+You can see the final version of `build.gradle` https://github.com/spring-guides/{project_id}/blob/master/complete/build.gradle[right here].
33
+
34
+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.
35
+It also searches for the `public static void main()` method to flag as a runnable class.
36
+
37
+Now run the following command to produce a single executable JAR file containing all necessary dependency classes and resources:
38
+
39
+[subs="attributes"]
40
+....
41
+$ ./gradlew build
42
+....
43
+
44
+If you are using Gradle, you can run the JAR by typing:
45
+
46
+[subs="attributes"]
47
+....
48
+$ java -jar build/libs/{project_id}-0.1.0.jar
49
+....
50
+
51
+If you are using Maven, you can run the JAR by typing:
52
+
53
+[subs="attributes"]
54
+....
55
+$ java -jar target/{project_id}-0.1.0.jar
56
+....
57
+
58
+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.
59
+

+ 8
- 0
macros/build_system_intro.asc Целия файл

@@ -0,0 +1,8 @@
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
+:linkattrs:
7
+
8
+First you set up a basic build script. You can use any build system you like when building apps with Spring, but the code you need to work with http://gradle.org[Gradle] and https://maven.apache.org[Maven] is included here. If you're not familiar with either, refer to link:/guides/gs/gradle[Building Java Projects with Gradle] or link:/guides/gs/maven[Building Java Projects with Maven].

+ 13
- 0
macros/create_both_builds.asc Целия файл

@@ -0,0 +1,13 @@
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
+=== Create a Gradle build file
7
+Below is the https://github.com/spring-guides/${project_id}/blob/master/initial/build.gradle[initial Gradle build file]. But you can also use Maven. The pom.xml file is included https://github.com/spring-guides/${project_id}/blob/master/initial/pom.xml[right here]. If you are using link:/guides/gs/sts[Spring Tool Suite (STS)], you can import the guide directly.
8
+
9
+// AsciiDoc source formatting doesn't support groovy, so using java instead
10
+[source,java]
11
+----
12
+include::../initial/build.gradle[]
13
+----

+ 13
- 0
macros/create_directory_structure_hello.asc Целия файл

@@ -0,0 +1,13 @@
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
+=== Create the directory structure
7
+
8
+In a project directory of your choosing, create the following subdirectory structure; for example, with `mkdir -p src/main/java/hello` on *nix systems:
9
+
10
+    └── src
11
+        └── main
12
+            └── java
13
+                └── hello

+ 21
- 0
macros/how_to_complete_this_guide.asc Целия файл

@@ -0,0 +1,21 @@
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
+ifndef::jump_ahead[:jump_ahead: Create a resource representation class]
7
+
8
+How to complete this guide
9
+--------------------------
10
+Like all Spring's link:/guides/gs[Getting Started guides], you can start from scratch and complete each step, or you can bypass basic setup steps that are already familiar to you. Either way, you end up with working code.
11
+
12
+To **start from scratch**, move on to xref:scratch[Set up the project].
13
+
14
+To **skip the basics**, do the following:
15
+
16
+ - https://github.com/spring-guides/{project_id}/archive/master.zip[Download] and unzip the source repository for this guide, or clone it using link:/guides/u/Git[Git]:
17
++git clone https://github.com/spring-guides/{project_id}.git+
18
+ - cd into +{project_id}/initial+
19
+ - Jump ahead to xref:initial[{jump_ahead}].
20
+
21
+**When you're finished**, you can check your results against the code in +{project_id}/complete+.

+ 13
- 0
macros/prereq_editor_jdk_buildtools.asc Целия файл

@@ -0,0 +1,13 @@
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
+:linkattrs:
7
+
8
+ifndef::java_version[:java_version: 1.6]
9
+
10
+ - A favorite text editor or IDE
11
+ - http://www.oracle.com/technetwork/java/javase/downloads/index.html[JDK {java_version}] or later
12
+ - http://maven.apache.org/download.cgi[Gradle 1.8+] or http://maven.apache.org/download.cgi[Maven 3.0+]
13
+ - You can also import the code from this guide as well as view the web page directly into link:/guides/gs/sts[Spring Tool Suite (STS)] and work your way through it from there.

+ 16
- 0
macros/run_the_application_with_both.asc Целия файл

@@ -0,0 +1,16 @@
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
+ifndef::module[:module: service]
7
+
8
+== Run the {module}
9
+If you are using Gradle, you can run your {module} at the command line this way:
10
+
11
+[subs="attributes"]
12
+....
13
+$ ./gradlew clean build && java -jar build/libs/{project_id}-0.1.0.jar
14
+....
15
+
16
+NOTE: If you are using Maven, you can run your {module} by typing +mvn clean package && java -jar target/{project_id}-0.1.0.jar+.