What tag comments are suitable for pom.xml?

I am currently browsing https://spring.io/guides/gs/maven/#scratch and I just found

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

and I wonder:

What is <!-- tag::joda[] --> useful for?

+5
source share
1 answer

The getting started guide you are reading is generated from AsciiDoc :

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

AsciiDoc is a document format equivalent to DocBook XML. Instead of copying parts of the source code, AsciiDoc syntax allows you to point to some parts of the source code.

To include the pom.xml part, you can use the following syntax:

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

which will include a snippet:

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

To answer your question, <!-- tag::joda[] --> is a marker that allows AsciiDoc to extract part of a file and insert it into the getting started guide.

0
source

Source: https://habr.com/ru/post/1269254/


All Articles