2017-06-27 34 views
5

我目前正在經歷https://spring.io/guides/gs/maven/#scratch和我剛剛發現什麼是標籤註釋在pom.xml中有用?

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

,我不知道:

什麼是<!-- tag::joda[] -->好?

回答

0

Getting Started Guide你正在閱讀,是從AsciiDoc文件生成:

https://github.com/spring-projects/spring-boot/blob/master/README.adoc

AsciiDoc是一個文件相當於將DocBook XML的格式。 AsciiDoc語法不是複製粘貼部分源代碼,而是允許指向源代碼的某些部分。

要包括你可以用下面的語法pom.xml中的一部分:

include::complete/pom.xml[tag=joda] 

其中將包括片段:

<!-- tag::joda[] --> 
<dependency> 
    <groupId>joda-time</groupId> 
    <artifactId>joda-time</artifactId> 
    <version>2.9.2</version> 
</dependency> 
<!-- end::joda[] --> 

要回答你的問題,<!-- tag::joda[] -->是一個標誌,允許AsciiDoc提取文件的一部分並將其插入入門指南。