Add Dependency Versions to Asciidoctor

Add dependency versions to asciidoctor and
spring-version -> spring-core-version

Issue gh-7801
This commit is contained in:
Rob Winch 2020-01-13 15:46:32 -06:00
parent 38c2010d21
commit 2e2974fc13
2 changed files with 37 additions and 23 deletions

View File

@ -1,14 +1,20 @@
apply plugin: 'io.spring.convention.docs' 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 { asciidoctor {
def ghTag = snapshotBuild ? 'master' : project.version def ghTag = snapshotBuild ? 'master' : project.version
def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag" def ghUrl = "https://github.com/spring-projects/spring-security/tree/$ghTag"
attributes 'spring-security-version' : project.version, attributes 'spring-security-version' : project.version,
'spring-version' : project(':spring-security-core').dependencyManagement.managedVersions['org.springframework:spring-core'],
'spring-boot-version' : springBootVersion, 'spring-boot-version' : springBootVersion,
revnumber : project.version, revnumber : project.version,
'gh-url': ghUrl, 'gh-url': ghUrl,
'gh-samples-url': "$ghUrl/samples" 'gh-samples-url': "$ghUrl/samples"
asciidoctorj {
attributeProvider resolvedVersions(project.configurations.testCompile)
}
} }
docsZip { docsZip {
@ -16,3 +22,17 @@ docsZip {
into 'guides' 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] }
}
}

View File

@ -31,8 +31,7 @@ Alternatively, you can manually add the starter, as the following example shows:
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,subs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<dependencies> <dependencies>
<!-- ... other dependency elements ... --> <!-- ... other dependency elements ... -->
@ -49,8 +48,7 @@ If you wish to override the Spring Security version, you may do so by providing
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,subs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<properties> <properties>
<!-- ... --> <!-- ... -->
@ -65,12 +63,11 @@ You can do so by adding a Maven property, as the following example shows:
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,subs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<properties> <properties>
<!-- ... --> <!-- ... -->
<spring.version>{spring-version}</spring.version> <spring.version>{spring-core-version}</spring.version>
</dependencies> </dependencies>
---- ----
==== ====
@ -84,8 +81,7 @@ When you use Spring Security without Spring Boot, the preferred way is to use Sp
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,ubs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@ -106,8 +102,7 @@ A minimal Spring Security Maven set of dependencies typically looks like the fol
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,subs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<dependencies> <dependencies>
<!-- ... other dependency elements ... --> <!-- ... other dependency elements ... -->
@ -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 <<modules>>. If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <<modules>>.
Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x. 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-version}, which can cause strange classpath problems. 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 `<dependencyManagement>` section of your `pom.xml` as the following example shows: 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:
.pom.xml .pom.xml
==== ====
[source,xml] [source,xml,subs="verbatim,attributes"]
[subs="verbatim,attributes"]
---- ----
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@ -140,7 +134,7 @@ The easiest way to resolve this is to use the `spring-framework-bom` within the
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId> <artifactId>spring-framework-bom</artifactId>
<version>{spring-version}</version> <version>{spring-core-version}</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -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+. 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]. 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] [source,groovy]
[subs="verbatim,attributes"] [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 <<modules>>. If you use additional features (such as LDAP, OpenID, and others), you need to also include the appropriate <<modules>>.
Spring Security builds against Spring Framework {spring-version} but should generally work with any newer version of Spring Framework 5.x. {JB} 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-version}, which can cause strange classpath problems. 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 `<dependencyManagement>` section of your `pom.xml`. The easiest way to resolve this is to use the `spring-framework-bom` within your `<dependencyManagement>` 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: 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 { dependencyManagement {
imports { 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]]
=== Gradle Repositories === Gradle Repositories