Skip to content

Commit 2ce61f1

Browse files
Improve build.gradle for building Antora
* Also fix docs for respective `javadoc:` macros Signed-off-by: Tran Ngoc Nhan <[email protected]>
1 parent a446e33 commit 2ce61f1

File tree

12 files changed

+36
-25
lines changed

12 files changed

+36
-25
lines changed

build.gradle

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,7 @@ antora {
8484
}
8585

8686
tasks.named('generateAntoraYml') {
87-
asciidocAttributes = project.provider({
88-
return ['project-version': project.version]
89-
})
87+
asciidocAttributes = project.provider( { generateAttributes() } )
9088
baseAntoraYmlFile = file('src/reference/antora/antora.yml')
9189
}
9290

@@ -724,3 +722,24 @@ publishing {
724722
}
725723
}
726724
}
725+
726+
def generateAttributes() {
727+
def springDocs = "https://docs.spring.io"
728+
def micrometerDocsPrefix = "https://docs.micrometer.io"
729+
730+
return [
731+
'project-version': project.version,
732+
'spring-integration-docs': "$springDocs/spring-integration/reference".toString(),
733+
'spring-framework-docs': "$springDocs/spring-framework/reference/${generateVersionWithoutPatch(springVersion)}".toString(),
734+
'spring-retry-java-docs': "$springDocs/spring-retry/docs/$springRetryVersion/apidocs".toString(),
735+
'javadoc-location-org-springframework-transaction': "$springDocs/spring-framework/docs/$springVersion/javadoc-api".toString(),
736+
'javadoc-location-org-springframework-amqp': "$springDocs/spring-amqp/docs/$project.version/api".toString(),
737+
'micrometer-docs': "$micrometerDocsPrefix/micrometer/reference/${generateVersionWithoutPatch(micrometerVersion)}".toString(),
738+
'micrometer-tracing-docs': "$micrometerDocsPrefix/tracing/reference/${generateVersionWithoutPatch(micrometerTracingVersion)}".toString()
739+
]
740+
}
741+
742+
static String generateVersionWithoutPatch(String version) {
743+
744+
return version.split('\\.')[0,1].join('.') + (version.endsWith('-SNAPSHOT') ? '-SNAPSHOT' : '')
745+
}

src/reference/antora/antora-playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ asciidoc:
2323
extensions:
2424
- '@asciidoctor/tabs'
2525
- '@springio/asciidoctor-extensions'
26+
- '@springio/asciidoctor-extensions/javadoc-extension'
2627
sourcemap: true
2728
urls:
2829
latest_version_segment: ''

src/reference/antora/antora.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,7 @@ asciidoc:
1515
attributes:
1616
attribute-missing: 'warn'
1717
chomp: 'all'
18-
spring-docs: 'https://docs.spring.io'
19-
spring-framework-docs: '{spring-docs}/spring-framework/reference'
20-
spring-integration-docs: '{spring-docs}/spring-integration/reference'
21-
spring-amqp-java-docs: '{spring-docs}/spring-amqp/docs/current/api/org/springframework/amqp'
22-
spring-framework-java-docs: '{spring-docs}/spring/docs/current/javadoc-api/org/springframework'
23-
spring-retry-java-docs: '{spring-docs}/spring-retry/docs/api/current/'
2418
# External projects URLs and related attributes
25-
micrometer-docs: 'https://docs.micrometer.io'
26-
micrometer-tracing-docs: '{micrometer-docs}/tracing/reference/'
27-
micrometer-micrometer-docs: '{micrometer-docs}/micrometer/reference/'
2819
rabbitmq-stream-docs: 'https://rabbitmq.github.io/rabbitmq-stream-java-client/stable/htmlsingle'
2920
rabbitmq-github: 'https://github.com/rabbitmq'
30-
rabbitmq-server-github: '{rabbitmq-github}/rabbitmq-server/tree/main/deps'
21+
rabbitmq-server-github: '{rabbitmq-github}/rabbitmq-server/tree/main/deps'

src/reference/antora/modules/ROOT/pages/amqp/broker-configuration.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public Exchange exchange() {
359359
}
360360
----
361361

362-
See the Javadoc for {spring-amqp-java-docs}/core/QueueBuilder.html[`org.springframework.amqp.core.QueueBuilder`] and {spring-amqp-java-docs}/core/ExchangeBuilder.html[`org.springframework.amqp.core.ExchangeBuilder`] for more information.
362+
See the Javadoc for javadoc:org.springframework.amqp.core.QueueBuilder[`org.springframework.amqp.core.QueueBuilder`] and javadoc:org.springframework.amqp.core.ExchangeBuilder[`org.springframework.amqp.core.ExchangeBuilder`] for more information.
363363

364364
Starting with version 2.0, the `ExchangeBuilder` now creates durable exchanges by default, to be consistent with the simple constructors on the individual `AbstractExchange` classes.
365365
To make a non-durable exchange with the builder, use `.durable(false)` before invoking `.build()`.

src/reference/antora/modules/ROOT/pages/amqp/connections.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public class MyService {
483483
----
484484

485485
It is important to unbind the resource after use.
486-
For more information, see the {spring-amqp-java-docs}/rabbit/connection/AbstractRoutingConnectionFactory.html[JavaDoc] for `AbstractRoutingConnectionFactory`.
486+
For more information, see the javadoc:org.springframework.amqp.rabbit.connection.AbstractRoutingConnectionFactory[JavaDoc] for `AbstractRoutingConnectionFactory`.
487487

488488
Starting with version 1.4, `RabbitTemplate` supports the SpEL `sendConnectionFactorySelectorExpression` and `receiveConnectionFactorySelectorExpression` properties, which are evaluated on each AMQP protocol interaction operation (`send`, `sendAndReceive`, `receive`, or `receiveAndReply`), resolving to a `lookupKey` value for the provided `AbstractRoutingConnectionFactory`.
489489
You can use bean references, such as `@vHostResolver.getVHost(#root)` in the expression.

src/reference/antora/modules/ROOT/pages/amqp/listener-queues.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Container can be initially configured to listen on zero queues.
88
Queues can be added and removed at runtime.
99
The `SimpleMessageListenerContainer` recycles (cancels and re-creates) all consumers when any pre-fetched messages have been processed.
1010
The `DirectMessageListenerContainer` creates/cancels individual consumer(s) for each queue without affecting consumers on other queues.
11-
See the {spring-amqp-java-docs}/rabbit/listener/AbstractMessageListenerContainer.html[Javadoc] for the `addQueues`, `addQueueNames`, `removeQueues` and `removeQueueNames` methods.
11+
See the javadoc:org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer[Javadoc] for the `addQueues`, `addQueueNames`, `removeQueues` and `removeQueueNames` methods.
1212

1313
If not all queues are available, the container tries to passively declare (and consume from) the missing queues every 60 seconds.
1414

src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/async-annotation-driven/enable.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In this case, and ignoring the RabbitMQ infrastructure setup, the `processOrder`
3737

3838
You can customize the listener container factory to use for each annotation, or you can configure an explicit default by implementing the `RabbitListenerConfigurer` interface.
3939
The default is required only if at least one endpoint is registered without a specific container factory.
40-
See the {spring-amqp-java-docs}/rabbit/annotation/RabbitListenerConfigurer.html[Javadoc] for full details and examples.
40+
See the javadoc:org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer[Javadoc] for full details and examples.
4141

4242
The container factories provide methods for adding `MessagePostProcessor` instances that are applied after receiving messages (before invoking the listener) and before sending replies.
4343

src/reference/antora/modules/ROOT/pages/amqp/receiving-messages/micrometer.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
= Micrometer Integration
33
:page-section-summary-toc: 1
44

5-
NOTE: This section documents the integration with {micrometer-micrometer-docs}[Micrometer].
5+
NOTE: This section documents the integration with {micrometer-docs}[Micrometer].
66
For integration with Micrometer Observation, see xref:amqp/receiving-messages/micrometer-observation.adoc[Micrometer Observation].
77

88
Starting with version 2.2, the listener containers will automatically create and update Micrometer `Timer` s for the listener, if `Micrometer` is detected on the class path, and a single `MeterRegistry` is present in the application context (or exactly one is annotated `@Primary`, such as when using Spring Boot).

src/reference/antora/modules/ROOT/pages/amqp/request-reply.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Those methods are quite useful for request-reply scenarios, since they handle th
66

77
Similar request-reply methods are also available where the `MessageConverter` is applied to both the request and reply.
88
Those methods are named `convertSendAndReceive`.
9-
See the {spring-amqp-java-docs}/core/AmqpTemplate.html[Javadoc of `AmqpTemplate`] for more detail.
9+
See the javadoc:org.springframework.amqp.core.AmqpTemplate[Javadoc of `AmqpTemplate`] for more detail.
1010

1111
Starting with version 1.5.0, each of the `sendAndReceive` method variants has an overloaded version that takes `CorrelationData`.
1212
Together with a properly configured connection factory, this enables the receipt of publisher confirms for the send side of the operation.
13-
See xref:amqp/template.adoc#template-confirms[Correlated Publisher Confirms and Returns] and the {spring-amqp-java-docs}/rabbit/core/RabbitOperations.html[Javadoc for `RabbitOperations`] for more information.
13+
See xref:amqp/template.adoc#template-confirms[Correlated Publisher Confirms and Returns] and the javadoc:org.springframework.amqp.rabbit.core.RabbitOperations[Javadoc for `RabbitOperations`] for more information.
1414

1515
Starting with version 2.0, there are variants of these methods (`convertSendAndReceiveAsType`) that take an additional `ParameterizedTypeReference` argument to convert complex returned types.
1616
The template must be configured with a `SmartMessageConverter`.

src/reference/antora/modules/ROOT/pages/amqp/sending-messages.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Message message = MessageBuilder.withBody("foo".getBytes())
100100
.build();
101101
----
102102

103-
Each of the properties defined on the {spring-amqp-java-docs}/core/MessageProperties.html[`MessageProperties`] can be set.
103+
Each of the properties defined on the javadoc:org.springframework.amqp.core.MessageProperties[] can be set.
104104
Other methods include `setHeader(String key, String value)`, `removeHeader(String key)`, `removeHeaders()`, and `copyProperties(MessageProperties properties)`.
105105
Each property setting method has a `set*IfAbsent()` variant.
106106
In the cases where a default initial value exists, the method is named `set*IfAbsentOrDefault()`.

0 commit comments

Comments
 (0)