瀏覽代碼

Make some edits and update macro system

Greg Turnquist 13 年之前
父節點
當前提交
154b265004

+ 1
- 0
.gitignore 查看文件

@@ -12,3 +12,4 @@ dependency-reduced-pom.xml
12 12
 *.sublime-*
13 13
 /scratch
14 14
 .gradle
15
+README.html

+ 15
- 9
README.adoc 查看文件

@@ -37,23 +37,29 @@ The `name` parameter value overrides the default value of "World" and is reflect
37 37
 
38 38
 == What you'll need
39 39
 
40
-include::macros/prereq_editor_jdk_buildtools.asc[]
40
+include::https://raw.github.com/spring-guides/getting-started-macros/master//prereq_editor_jdk_buildtools.adoc[]
41 41
 
42 42
 
43
-include::macros/how_to_complete_this_guide.asc[]
43
+include::https://raw.github.com/spring-guides/getting-started-macros/master//how_to_complete_this_guide.adoc[]
44 44
 
45 45
 
46 46
 [[scratch]]
47 47
 == Set up the project
48 48
 
49
-include::macros/build_system_intro.asc[]
49
+include::https://raw.github.com/spring-guides/getting-started-macros/master//build_system_intro.adoc[]
50 50
 
51
-include::macros/create_directory_structure_hello.asc[]
51
+include::https://raw.github.com/spring-guides/getting-started-macros/master//create_directory_structure_hello.adoc[]
52 52
 
53 53
 
54
-include::macros/create_both_builds.asc[]
54
+include::https://raw.github.com/spring-guides/getting-started-macros/master//create_both_builds.adoc[]
55
+`build.gradle`
56
+// AsciiDoc source formatting doesn't support groovy, so using java instead
57
+[source,java]
58
+----
59
+include::../initial/build.gradle[]
60
+----
55 61
 
56
-include::macros/bootstrap_starter_pom_disclaimer.asc[]
62
+include::https://raw.github.com/spring-guides/getting-started-macros/master//bootstrap_starter_pom_disclaimer.adoc[]
57 63
 
58 64
 
59 65
 [[initial]]
@@ -132,12 +138,12 @@ The `@ComponentScan` annotation tells Spring to search recursively through the `
132 138
 
133 139
 The http://docs.spring.io/spring-boot/docs/{spring_boot_version}/api/org/springframework/boot/autoconfigure/EnableAutoConfiguration.html[`@EnableAutoConfiguration`] annotation switches on reasonable default behaviors based on the content of your classpath. For example, because the application depends on the embeddable version of Tomcat (tomcat-embed-core.jar), a Tomcat server is set up and configured with reasonable defaults on your behalf. And because the application also depends on Spring MVC (spring-webmvc.jar), a Spring MVC http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/DispatcherServlet.html[`DispatcherServlet`] is configured and registered for you — no `web.xml` necessary! Auto-configuration is a powerful, flexible mechanism. See the http://docs.spring.io/spring-boot/docs/{spring_boot_version}/api/org/springframework/boot/autoconfigure/EnableAutoConfiguration.html[API documentation] for further details.
134 140
 
135
-include::macros/build_an_executable_jar_subhead.asc[]
141
+include::https://raw.github.com/spring-guides/getting-started-macros/master//build_an_executable_jar_subhead.adoc[]
136 142
 
137
-include::macros/build_an_executable_jar_with_both.asc[]
143
+include::https://raw.github.com/spring-guides/getting-started-macros/master//build_an_executable_jar_with_both.adoc[]
138 144
 
139 145
 :module: service
140
-include::macros/run_the_application_with_both.asc[]
146
+include::https://raw.github.com/spring-guides/getting-started-macros/master//run_the_application_with_both.adoc[]
141 147
 
142 148
 Logging output is displayed. The service should be up and running within a few seconds.
143 149
 

+ 0
- 6
macros/bootstrap_starter_pom_disclaimer.asc 查看文件

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

+ 0
- 6
macros/build_an_executable_jar_mainhead.asc 查看文件

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

+ 0
- 6
macros/build_an_executable_jar_subhead.asc 查看文件

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

+ 0
- 60
macros/build_an_executable_jar_with_both.asc 查看文件

@@ -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
-

+ 0
- 9
macros/build_system_intro.asc 查看文件

@@ -1,9 +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
-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].

+ 0
- 14
macros/create_both_builds.asc 查看文件

@@ -1,14 +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
-=== 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
-`build.gradle`
10
-// AsciiDoc source formatting doesn't support groovy, so using java instead
11
-[source,java]
12
-----
13
-include::../initial/build.gradle[]
14
-----

+ 0
- 13
macros/create_directory_structure_hello.asc 查看文件

@@ -1,13 +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
-=== 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

+ 0
- 21
macros/how_to_complete_this_guide.asc 查看文件

@@ -1,21 +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
-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+.

+ 0
- 15
macros/prereq_editor_jdk_buildtools.asc 查看文件

@@ -1,15 +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
-ifndef::java_version[:java_version: 1.6]
10
-
11
- - About 15 minutes
12
- - A favorite text editor or IDE
13
- - http://www.oracle.com/technetwork/java/javase/downloads/index.html[JDK {java_version}] or later
14
- - http://maven.apache.org/download.cgi[Gradle 1.8+] or http://maven.apache.org/download.cgi[Maven 3.0+]
15
- - 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.

+ 0
- 16
macros/run_the_application_with_both.asc 查看文件

@@ -1,16 +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
-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", role="has-copy-button"]
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+.

+ 0
- 19
macros/run_the_utility.asc 查看文件

@@ -1,19 +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
-To run the utility, simply run it from the command line using link:/guides/gs/gradle[Gradle] like this:
8
-
9
-[subs="attributes"]
10
-----
11
-$ ./gradlew clean build && java -jar build/libs/{project_id}-0.1.0.jar
12
-----
13
-
14
-Or if you are using link:/guides/gs/maven[Maven], run it like this:
15
-
16
-[subs="attributes"]
17
-----
18
-$ mvn package && java -jar target/{project_id}-0.1.0.jar
19
-----