Skip to content

Commit 2e2974f

Browse files
committed
Add Dependency Versions to Asciidoctor
Add dependency versions to asciidoctor and spring-version -> spring-core-version Issue gh-7801
1 parent 38c2010 commit 2e2974f

File tree

2 files changed

+37
-23
lines changed

2 files changed

+37
-23
lines changed
Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
apply plugin: 'io.spring.convention.docs'
2+
apply plugin: 'io.spring.convention.springdependencymangement'
3+
apply plugin: 'io.spring.convention.dependency-set'
4+
apply plugin: 'io.spring.convention.repository'
5+
apply plugin: 'java'
26

37
asciidoctor {
48
def ghTag = snapshotBuild ? 'master' : project.version
59
def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag"
610
attributes 'spring-security-version' : project.version,
7-
'spring-version' : project(':spring-security-core').dependencyManagement.managedVersions['org.springframework:spring-core'],
811
'spring-boot-version' : springBootVersion,
912
revnumber : project.version,
1013
'gh-url': ghUrl,
1114
'gh-samples-url': "$ghUrl/samples"
15+
asciidoctorj {
16+
attributeProvider resolvedVersions(project.configurations.testCompile)
17+
}
1218
}
1319

1420
docsZip {
1521
from(project(':spring-security-docs-guides').asciidoctor) {
1622
into 'guides'
1723
}
1824
}
25+
26+
dependencies {
27+
testCompile "com.unboundid:unboundid-ldapsdk"
28+
testCompile "org.apache.directory.server:apacheds-core"
29+
testCompile "org.springframework:spring-core"
30+
}
31+
32+
def resolvedVersions(Configuration configuration) {
33+
return {
34+
configuration.resolvedConfiguration
35+
.resolvedArtifacts
36+
.collectEntries { [(it.name + "-version"): it.moduleVersion.id.version] }
37+
}
38+
}

docs/manual/src/docs/asciidoc/_includes/about/getting-spring-security.adoc

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ Alternatively, you can manually add the starter, as the following example shows:
3131

3232
.pom.xml
3333
====
34-
[source,xml]
35-
[subs="verbatim,attributes"]
34+
[source,xml,subs="verbatim,attributes"]
3635
----
3736
<dependencies>
3837
<!-- ... other dependency elements ... -->
@@ -49,8 +48,7 @@ If you wish to override the Spring Security version, you may do so by providing
4948

5049
.pom.xml
5150
====
52-
[source,xml]
53-
[subs="verbatim,attributes"]
51+
[source,xml,subs="verbatim,attributes"]
5452
----
5553
<properties>
5654
<!-- ... -->
@@ -65,12 +63,11 @@ You can do so by adding a Maven property, as the following example shows:
6563

6664
.pom.xml
6765
====
68-
[source,xml]
69-
[subs="verbatim,attributes"]
66+
[source,xml,subs="verbatim,attributes"]
7067
----
7168
<properties>
7269
<!-- ... -->
73-
<spring.version>{spring-version}</spring.version>
70+
<spring.version>{spring-core-version}</spring.version>
7471
</dependencies>
7572
----
7673
====
@@ -84,8 +81,7 @@ When you use Spring Security without Spring Boot, the preferred way is to use Sp
8481

8582
.pom.xml
8683
====
87-
[source,xml]
88-
[subs="verbatim,attributes"]
84+
[source,xml,ubs="verbatim,attributes"]
8985
----
9086
<dependencyManagement>
9187
<dependencies>
@@ -106,8 +102,7 @@ A minimal Spring Security Maven set of dependencies typically looks like the fol
106102

107103
.pom.xml
108104
====
109-
[source,xml]
110-
[subs="verbatim,attributes"]
105+
[source,xml,subs="verbatim,attributes"]
111106
----
112107
<dependencies>
113108
<!-- ... other dependency elements ... -->
@@ -125,22 +120,21 @@ A minimal Spring Security Maven set of dependencies typically looks like the fol
125120

126121
If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <<modules>>.
127122

128-
Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x.
129-
Many users are likely to run afoul of the fact that Spring Security's transitive dependencies resolve Spring Framework {spring-version}, which can cause strange classpath problems.
123+
Spring Security builds against Spring Framework {spring-core-version} but should generally work with any newer version of Spring Framework 5.x.
124+
Many users are likely to run afoul of the fact that Spring Security's transitive dependencies resolve Spring Framework {spring-core-version}, which can cause strange classpath problems.
130125
The easiest way to resolve this is to use the `spring-framework-bom` within the `<dependencyManagement>` section of your `pom.xml` as the following example shows:
131126

132127
.pom.xml
133128
====
134-
[source,xml]
135-
[subs="verbatim,attributes"]
129+
[source,xml,subs="verbatim,attributes"]
136130
----
137131
<dependencyManagement>
138132
<dependencies>
139133
<!-- ... other dependency elements ... -->
140134
<dependency>
141135
<groupId>org.springframework</groupId>
142136
<artifactId>spring-framework-bom</artifactId>
143-
<version>{spring-version}</version>
137+
<version>{spring-core-version}</version>
144138
<type>pom</type>
145139
<scope>import</scope>
146140
</dependency>
@@ -149,7 +143,7 @@ The easiest way to resolve this is to use the `spring-framework-bom` within the
149143
----
150144
====
151145

152-
The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-version} modules.
146+
The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-core-version} modules.
153147

154148
NOTE: This approach uses Maven's "`bill of materials`" (BOM) concept and is only available in Maven 2.0.9+.
155149
For additional details about how dependencies are resolved, see https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html[Maven's Introduction to the Dependency Mechanism documentation].
@@ -238,7 +232,7 @@ You can do so by adding a Gradle property, as the following example shows:
238232
[source,groovy]
239233
[subs="verbatim,attributes"]
240234
----
241-
ext['spring.version']='{spring-version}'
235+
ext['spring.version']='{spring-core-version}'
242236
----
243237
====
244238

@@ -282,8 +276,8 @@ dependencies {
282276

283277
If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <<modules>>.
284278

285-
Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x. {JB}
286-
Many users are likely to run afoul of the fact that Spring Security's transitive dependencies resolve Spring Framework {spring-version}, which can cause strange classpath problems.
279+
Spring Security builds against Spring Framework {spring-core-version} but should generally work with any newer version of Spring Framework 5.x. {JB}
280+
Many users are likely to run afoul of the fact that Spring Security's transitive dependencies resolve Spring Framework {spring-core-version}, which can cause strange classpath problems.
287281
The easiest way to resolve this is to use the `spring-framework-bom` within your `<dependencyManagement>` section of your `pom.xml`.
288282
You can do so by using the https://github.com/spring-gradle-plugins/dependency-management-plugin[Dependency Management Plugin], as the following example shows:
289283

@@ -298,13 +292,13 @@ plugins {
298292
299293
dependencyManagement {
300294
imports {
301-
mavenBom 'org.springframework:spring-framework-bom:{spring-version}'
295+
mavenBom 'org.springframework:spring-framework-bom:{spring-core-version}'
302296
}
303297
}
304298
----
305299
====
306300

307-
The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-version} modules.
301+
The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-core-version} modules.
308302

309303
[[gradle-repositories]]
310304
=== Gradle Repositories

0 commit comments

Comments
 (0)