From 2e2974fc13438c88999710ed1ad5f742a502d31b Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Mon, 13 Jan 2020 15:46:32 -0600 Subject: [PATCH] Add Dependency Versions to Asciidoctor Add dependency versions to asciidoctor and spring-version -> spring-core-version Issue gh-7801 --- .../manual/spring-security-docs-manual.gradle | 22 ++++++++++- .../about/getting-spring-security.adoc | 38 ++++++++----------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/docs/manual/spring-security-docs-manual.gradle b/docs/manual/spring-security-docs-manual.gradle index 4006bac83a..3f378acbee 100644 --- a/docs/manual/spring-security-docs-manual.gradle +++ b/docs/manual/spring-security-docs-manual.gradle @@ -1,14 +1,20 @@ apply plugin: 'io.spring.convention.docs' +apply plugin: 'io.spring.convention.springdependencymangement' +apply plugin: 'io.spring.convention.dependency-set' +apply plugin: 'io.spring.convention.repository' +apply plugin: 'java' asciidoctor { def ghTag = snapshotBuild ? 'master' : project.version def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag" attributes 'spring-security-version' : project.version, - 'spring-version' : project(':spring-security-core').dependencyManagement.managedVersions['org.springframework:spring-core'], 'spring-boot-version' : springBootVersion, revnumber : project.version, 'gh-url': ghUrl, 'gh-samples-url': "$ghUrl/samples" + asciidoctorj { + attributeProvider resolvedVersions(project.configurations.testCompile) + } } docsZip { @@ -16,3 +22,17 @@ docsZip { into 'guides' } } + +dependencies { + testCompile "com.unboundid:unboundid-ldapsdk" + testCompile "org.apache.directory.server:apacheds-core" + testCompile "org.springframework:spring-core" +} + +def resolvedVersions(Configuration configuration) { + return { + configuration.resolvedConfiguration + .resolvedArtifacts + .collectEntries { [(it.name + "-version"): it.moduleVersion.id.version] } + } +} diff --git a/docs/manual/src/docs/asciidoc/_includes/about/getting-spring-security.adoc b/docs/manual/src/docs/asciidoc/_includes/about/getting-spring-security.adoc index 46d5f21685..63839b9b5a 100644 --- a/docs/manual/src/docs/asciidoc/_includes/about/getting-spring-security.adoc +++ b/docs/manual/src/docs/asciidoc/_includes/about/getting-spring-security.adoc @@ -31,8 +31,7 @@ Alternatively, you can manually add the starter, as the following example shows: .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,subs="verbatim,attributes"] ---- @@ -49,8 +48,7 @@ If you wish to override the Spring Security version, you may do so by providing .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,subs="verbatim,attributes"] ---- @@ -65,12 +63,11 @@ You can do so by adding a Maven property, as the following example shows: .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,subs="verbatim,attributes"] ---- - {spring-version} + {spring-core-version} ---- ==== @@ -84,8 +81,7 @@ When you use Spring Security without Spring Boot, the preferred way is to use Sp .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,ubs="verbatim,attributes"] ---- @@ -106,8 +102,7 @@ A minimal Spring Security Maven set of dependencies typically looks like the fol .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,subs="verbatim,attributes"] ---- @@ -125,14 +120,13 @@ A minimal Spring Security Maven set of dependencies typically looks like the fol If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <>. -Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x. -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. +Spring Security builds against Spring Framework {spring-core-version} but should generally work with any newer version of Spring Framework 5.x. +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. The easiest way to resolve this is to use the `spring-framework-bom` within the `` section of your `pom.xml` as the following example shows: .pom.xml ==== -[source,xml] -[subs="verbatim,attributes"] +[source,xml,subs="verbatim,attributes"] ---- @@ -140,7 +134,7 @@ The easiest way to resolve this is to use the `spring-framework-bom` within the org.springframework spring-framework-bom - {spring-version} + {spring-core-version} pom import @@ -149,7 +143,7 @@ The easiest way to resolve this is to use the `spring-framework-bom` within the ---- ==== -The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-version} modules. +The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-core-version} modules. NOTE: This approach uses Maven's "`bill of materials`" (BOM) concept and is only available in Maven 2.0.9+. 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: [source,groovy] [subs="verbatim,attributes"] ---- -ext['spring.version']='{spring-version}' +ext['spring.version']='{spring-core-version}' ---- ==== @@ -282,8 +276,8 @@ dependencies { If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <>. -Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x. {JB} -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. +Spring Security builds against Spring Framework {spring-core-version} but should generally work with any newer version of Spring Framework 5.x. {JB} +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. The easiest way to resolve this is to use the `spring-framework-bom` within your `` section of your `pom.xml`. You can do so by using the https://github.com/spring-gradle-plugins/dependency-management-plugin[Dependency Management Plugin], as the following example shows: @@ -298,13 +292,13 @@ plugins { dependencyManagement { imports { - mavenBom 'org.springframework:spring-framework-bom:{spring-version}' + mavenBom 'org.springframework:spring-framework-bom:{spring-core-version}' } } ---- ==== -The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-version} modules. +The preceding example ensures that all the transitive dependencies of Spring Security use the Spring {spring-core-version} modules. [[gradle-repositories]] === Gradle Repositories