Skip to content

Commit 31a570c

Browse files
Devashish Bhattacharjeeodrotbohm
authored andcommitted
GH-255 - Add Gradle snippets for build related samples to the reference documentation.
1 parent c43a338 commit 31a570c

File tree

5 files changed

+113
-9
lines changed

5 files changed

+113
-9
lines changed

src/docs/antora/modules/ROOT/pages/events.adoc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ As the needs for that kind of housekeeping strongly vary from application to app
133133
That API is available through the `spring-modulith-events-api` artifact, that you can add to your application:
134134

135135
.Using Spring Modulith Events API artifact
136-
[source, xml, subs="+attributes"]
136+
[tabs]
137+
======
138+
Maven::
139+
+
140+
[source, xml, subs="+attributes", role="primary"]
137141
----
138142
<dependency>
139143
<groupId>org.springframework.modulith</groupId>
@@ -142,6 +146,16 @@ That API is available through the `spring-modulith-events-api` artifact, that yo
142146
</dependency>
143147
----
144148
149+
Gradle::
150+
+
151+
[source, subs="+attributes", role="secondary"]
152+
----
153+
dependencies {
154+
implementation 'org.springframework.modulith:spring-modulith-events-api:{projectVersion}'
155+
}
156+
----
157+
======
158+
145159
This artifact contains two primary abstractions, that are available to application code as Spring Beans:
146160

147161
* `CompletedEventPublications` -- This interface allows accessing all completed event publications, and provides API to immediately purge all of them from the database or the completed publications older that a given duration (for example, 1 minute).

src/docs/antora/modules/ROOT/pages/index.adoc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ NOTE: Copies of this document may be made for your own use and for distribution
2626
Spring Modulith consists of a set of libraries that can be used individually and depending on which features of it you would like to use.
2727
To ease the declaration of the individual modules, we recommend to declare the following BOM in your Maven POM:
2828

29-
.Using the Spring Modulith BOM
30-
[source, xml, subs="+attributes"]
29+
.Using the Spring Modulith BOM
30+
[tabs]
31+
======
32+
Maven::
33+
+
34+
[source, xml, subs="+attributes", role="primary"]
3135
----
3236
<dependencyManagement>
3337
<dependencies>
@@ -42,6 +46,18 @@ To ease the declaration of the individual modules, we recommend to declare the f
4246
</dependencyManagement>
4347
----
4448
49+
Gradle::
50+
+
51+
[source, subs="+attributes", role="secondary"]
52+
----
53+
dependencyManagement {
54+
imports {
55+
mavenBom 'org.springframework.modulith:spring-modulith-bom:{projectVersion}'
56+
}
57+
}
58+
----
59+
======
60+
4561
The individual sections describing Spring Modulith features will refer to the individual artifacts that are needed to make use of the feature.
4662
For an overview about all modules available, have a look at xref:appendix.adoc#artifacts[Spring Modulith modules].
4763

src/docs/antora/modules/ROOT/pages/moments.adoc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,28 @@ It's an event-based approach to time to trigger actions that are tied to a parti
66

77
To use the abstraction, include the following dependency in your project:
88

9-
[source, xml]
9+
[tabs]
10+
======
11+
Maven::
12+
+
13+
[source, xml, role="primary"]
1014
----
1115
<dependency>
1216
<groupId>org.springframework.modulith</groupId>
1317
<artifactId>spring-modulith-moments</artifactId>
1418
</dependency>
1519
----
1620
21+
Gradle::
22+
+
23+
[source, role="secondary"]
24+
----
25+
dependencies {
26+
implementation 'org.springframework.modulith:spring-modulith-moments'
27+
}
28+
----
29+
======
30+
1731
The dependency added to the project's classpath causes the following things in your application:
1832

1933
* Application code can refer to `HourHasPassed`, `DayHasPassed`, `WeekHasPassed`, `MonthHasPassed`, `QuarterHasPassed`, `YearHasPassed` types in Spring event listeners to get notified if a certain amount of time has passed.

src/docs/antora/modules/ROOT/pages/production-ready.adoc

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ Spring Modulith provides support to expose architectural information about your
55
As a production-ready application is likely to require both, the most convenient way to activate those features is to use the Spring Modulith Insight starter as follows:
66

77
.Using the Spring Modulith Insight starter
8-
[source, xml, subs="+attributes"]
8+
[tabs]
9+
======
10+
Maven::
11+
+
12+
[source, xml, subs="+attributes", role="primary"]
913
----
1014
<dependency>
1115
<groupId>org.springframework.modulith</groupId>
@@ -15,6 +19,16 @@ As a production-ready application is likely to require both, the most convenien
1519
</dependency>
1620
----
1721
22+
Gradle::
23+
+
24+
[source, subs="+attributes", role="secondary"]
25+
----
26+
dependencies {
27+
runtimeOnly 'org.springframework.modulith:spring-modulith-starter-insight:{projectVersion}'
28+
}
29+
----
30+
======
31+
1832
This will include the actuator and observability support as well as Spring Boot's actuator startup for general support for actuators.
1933
Note, that you will still have to add further dependencies to connect your application to your monitoring tools such as https://zipkin.io/[Zipkin], https://docs.wavefront.com/[Wavefront] etc. usually via https://opentelemetry.io/[OpenTelemetry] or https://github.com/openzipkin/brave[Brave].
2034
Find more information on that in https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing[the corresponding section] of Spring Boot's reference documentation.
@@ -26,7 +40,11 @@ The application module structure can be exposed as Spring Boot actuator.
2640
To enable the actuator, add the `spring-modulith-actuator` dependency to the project:
2741

2842
.Using the Spring Modulith actuator support
29-
[source, xml, subs="+attributes"]
43+
[tabs]
44+
======
45+
Maven::
46+
+
47+
[source, xml, subs="+attributes", role="primary"]
3048
----
3149
<dependency>
3250
<groupId>org.springframework.modulith</groupId>
@@ -44,6 +62,21 @@ To enable the actuator, add the `spring-modulith-actuator` dependency to the pro
4462
</dependency>
4563
----
4664
65+
Gradle::
66+
+
67+
[source, subs="+attributes", role="secondary"]
68+
----
69+
dependencies {
70+
runtimeOnly 'org.springframework.modulith:spring-modulith-actuator:{projectVersion}'
71+
}
72+
73+
<!-- Spring Boot actuator starter required to enable actuators in general -->
74+
dependencies {
75+
runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator'
76+
}
77+
----
78+
======
79+
4780
Running the application will now expose an `modulith` actuator resource:
4881

4982
.Accessing the actuator HTTP resource
@@ -119,7 +152,11 @@ The interaction between application modules can be intercepted to create Microme
119152
To activate the instrumentation add the following runtime dependency to your project:
120153

121154
.Using the Spring Modulith observability support
122-
[source, xml, subs="+attributes"]
155+
[tabs]
156+
======
157+
Maven::
158+
+
159+
[source, xml, subs="+attributes", role="primary"]
123160
----
124161
<dependency>
125162
<groupId>org.springframework.modulith</groupId>
@@ -129,6 +166,16 @@ To activate the instrumentation add the following runtime dependency to your pro
129166
</dependency>
130167
----
131168
169+
Gradle::
170+
+
171+
[source, subs="+attributes", role="secondary"]
172+
----
173+
dependencies {
174+
runtimeOnly 'org.springframework.modulith:spring-modulith-observability:{projectVersion}'
175+
}
176+
----
177+
======
178+
132179
NOTE: You will have to configure additional infrastructure dependencies depending on the tooling you want to pipe the observability metadata in.
133180
For details, please check the corresponding https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing[Spring Boot documentation] on which dependencies to include for your setup.
134181

src/docs/antora/modules/ROOT/pages/runtime.adoc

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ In this section we are going to describe Spring Modulith's support for
88
== Setting up Runtime Support for Application Modules
99

1010
To enable the runtime support for Spring Modulith, make sure you include the `spring-modulith-runtime` JAR in your project.
11-
12-
[source, xml]
11+
[tabs]
12+
======
13+
Maven::
14+
+
15+
[source, xml, role="primary"]
1316
----
1417
<dependency>
1518
<groupId>org.springframework.modulith</groupId>
@@ -18,6 +21,16 @@ To enable the runtime support for Spring Modulith, make sure you include the `sp
1821
</dependency>
1922
----
2023
24+
Gradle::
25+
+
26+
[source, xml, role="secondary"]
27+
----
28+
dependencies {
29+
runtimeOnly 'org.springframework.modulith:spring-modulith-runtime'
30+
}
31+
----
32+
======
33+
2134
IMPORTANT: It's worth noting that using the runtime support of Spring Modulith will mean that you include both https://www.archunit.org/[ArchUnit] and the https://jgrapht.org/[JGraphT] (required to topologically sort application modules) library in your application.
2235

2336
Adding this JAR will cause Spring Boot auto-configuration to run that registers the following components in your application:

0 commit comments

Comments
 (0)