I'm currently going through 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[] -->
good for?
Rules for adding XML commentsDon't use a comment before an XML declaration. You can use a comment anywhere in XML document except within attribute value. Don't nest a comment inside the other comment.
pluginManagement: is an element that is seen along side plugins. Plugin Management contains plugin elements in much the same way, except that rather than configuring plugin information for this particular project build, it is intended to configure project builds that inherit from this one.
A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.
The Getting Started Guide you are reading, is generated from an AsciiDoc file:
https://github.com/spring-projects/spring-boot/blob/master/README.adoc
AsciiDoc is a document format equivalent to DocBook XML. Instead of copy-pasting part of the source code, the AsciiDoc syntax allows to point to some parts of the source code.
To include a part of the pom.xml you can use the following syntax:
include::complete/pom.xml[tag=joda]
which will include the snippet:
<!-- tag::joda[] -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
<!-- end::joda[] -->
To answer you question, <!-- tag::joda[] -->
is a marker allowing AsciiDoc to extract a part of the file and inserting it into the getting started guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With