我目前正在浏览https://spring.io/guides/gs/maven/#scratch,我刚刚发现
<dependencies>
<!-- tag::joda[] -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
<!-- end::joda[] -->
<!-- tag::junit[] -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- end::junit[] -->
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我想知道:
有什么<!-- tag::joda[] -->好处?
您正在阅读的入门指南是从AsciiDoc文件生成的:
https://github.com/spring-projects/spring-boot/blob/master/README.adoc
AsciiDoc 是一种与 DocBook XML 等效的文档格式。AsciiDoc 语法允许指向源代码的某些部分,而不是复制粘贴部分源代码。
要包含 pom.xml 的一部分,您可以使用以下语法:
include::complete/pom.xml[tag=joda]
Run Code Online (Sandbox Code Playgroud)
其中将包括片段:
<!-- tag::joda[] -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
<!-- end::joda[] -->
Run Code Online (Sandbox Code Playgroud)
为了回答您的问题,<!-- tag::joda[] -->有一个标记允许 AsciiDoc 提取文件的一部分并将其插入到入门指南中。