Commit 3328a30b authored by Andy Wilkinson's avatar Andy Wilkinson

Include details of dependency versions in the docs

Closes #637
parent 307fbba9
...@@ -70,6 +70,79 @@ ...@@ -70,6 +70,79 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-maven-plugin</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.version}</version>
<classifier>site</classifier>
<type>jar</type>
<outputDirectory>
${project.build.directory}/contents/maven-plugin
</outputDirectory>
<excludes>META-INF/**</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>unpack-dependency-tools-effective-pom</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependency-tools</artifactId>
<version>${project.version}</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<includes>**/effective-pom.xml</includes>
<outputDirectory>${project.build.directory}/external-resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<goals>
<goal>transform</goal>
</goals>
</execution>
</executions>
<configuration>
<transformationSets>
<transformationSet>
<dir>${project.build.directory}/external-resources</dir>
<stylesheet>src/main/xslt/dependencyVersions.xsl</stylesheet>
<fileMappers>
<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper">
<targetExtension>.adoc</targetExtension>
</fileMapper>
</fileMappers>
<outputDir>${project.build.directory}/generated-resources</outputDir>
</transformationSet>
</transformationSets>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.asciidoctor</groupId> <groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId> <artifactId>asciidoctor-maven-plugin</artifactId>
...@@ -219,34 +292,6 @@ ...@@ -219,34 +292,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-maven-plugin</id>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.version}</version>
<classifier>site</classifier>
<type>jar</type>
<outputDirectory>
${project.build.directory}/contents/maven-plugin
</outputDirectory>
<excludes>META-INF/**</excludes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
......
[appendix]
[[appendix-dependency-versions]]
== Dependency versions
The table below provides details of all of the dependency versions that are provided by Spring Boot
in its CLI, Maven dependency management and Gradle plugin. When you declare a dependency on one of
these artifacts without declaring a version the version that is listed in the table will be used.
include::../../../target/generated-resources/org/springframework/boot/dependency/tools/effective-pom.adoc[]
\ No newline at end of file
...@@ -275,3 +275,5 @@ alternatives could be considered: ...@@ -275,3 +275,5 @@ alternatives could be considered:
* http://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin] * http://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]
* http://www.jdotsoft.com/JarClassLoader.php[JarClassLoader] * http://www.jdotsoft.com/JarClassLoader.php[JarClassLoader]
* http://one-jar.sourceforge.net[OneJar] * http://one-jar.sourceforge.net[OneJar]
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
include::appendix-application-properties.adoc[] include::appendix-application-properties.adoc[]
include::appendix-auto-configuration-classes.adoc[] include::appendix-auto-configuration-classes.adoc[]
include::appendix-executable-jar-format.adoc[] include::appendix-executable-jar-format.adoc[]
include::appendix-dependency-versions.adoc[]
...@@ -202,12 +202,8 @@ If you are using a milestone or snapshot release you will also need to add appro ...@@ -202,12 +202,8 @@ If you are using a milestone or snapshot release you will also need to add appro
=== Declaring dependencies without versions === Declaring dependencies without versions
The `spring-boot` plugin will register a custom Gradle `ResolutionStrategy` with your The `spring-boot` plugin will register a custom Gradle `ResolutionStrategy` with your
build that allows you to omit version numbers when declaring dependencies to ``blessed'' build that allows you to omit version numbers when declaring dependencies to ``blessed''
artifacts. All artifacts with a `org.springframework.boot` group ID, and any of the artifacts. To make use of this functionality, simply declare dependencies in the usual way,
artifacts declared in the `managementDependencies` section of the but leave the version number empty:
{github-code}/spring-boot-dependencies/pom.xml[`spring-dependencies`]
POM can have their version number resolved automatically.
Simply declare dependencies in the usual way, but leave the version number empty:
[source,groovy,indent=0,subs="verbatim,attributes"] [source,groovy,indent=0,subs="verbatim,attributes"]
---- ----
...@@ -221,9 +217,20 @@ Simply declare dependencies in the usual way, but leave the version number empty ...@@ -221,9 +217,20 @@ Simply declare dependencies in the usual way, but leave the version number empty
NOTE: The version of the `spring-boot` gradle plugin that you declare determines the NOTE: The version of the `spring-boot` gradle plugin that you declare determines the
actual versions of the ``blessed'' dependencies (this ensures that builds are always actual versions of the ``blessed'' dependencies (this ensures that builds are always
repeatable). You should always set the version of the `spring-boot` gradle plugin to the repeatable). You should always set the version of the `spring-boot` gradle plugin to the
actual Spring Boot version that you wish to use. actual Spring Boot version that you wish to use. Details of the versions that are
provided can be found in the <<appendix-dependency-versions, appendix>>.
The `spring-boot` plugin will only supply a version where one is not specified. To
use a version of an artifact that differs from the one that the plugin would provide,
simply specify the version when you declare the dependency as you usually would. For
example:
[source,groovy,indent=0,subs="verbatim,attributes"]
----
dependencies {
compile("org.thymeleaf:thymeleaf-spring4:2.1.1.RELEASE")
}
----
[[build-tool-plugins-gradle-custom-version-management]] [[build-tool-plugins-gradle-custom-version-management]]
==== Custom version management ==== Custom version management
...@@ -250,8 +257,6 @@ the above example `mycorp-versions.properties` file might contain the following: ...@@ -250,8 +257,6 @@ the above example `mycorp-versions.properties` file might contain the following:
The properties file takes precedence over Spring Boot's defaults, and can be used The properties file takes precedence over Spring Boot's defaults, and can be used
to override version numbers if necessary. to override version numbers if necessary.
[[build-tool-plugins-gradle-packaging]] [[build-tool-plugins-gradle-packaging]]
=== Packaging executable jar and war files === Packaging executable jar and war files
Once the `spring-boot` plugin has been applied to your project it will automatically Once the `spring-boot` plugin has been applied to your project it will automatically
...@@ -520,8 +525,6 @@ Here is a typical example repackage: ...@@ -520,8 +525,6 @@ Here is a typical example repackage:
}); });
---- ----
[[build-tool-plugins-whats-next]] [[build-tool-plugins-whats-next]]
== What to read next == What to read next
If you're interested in how the build tool plugins work you can If you're interested in how the build tool plugins work you can
......
...@@ -160,7 +160,8 @@ without a group or version, for example `@Grab('freemarker')`. This will consult ...@@ -160,7 +160,8 @@ without a group or version, for example `@Grab('freemarker')`. This will consult
default dependency metadata to deduce the artifact's group and version. Note that the default default dependency metadata to deduce the artifact's group and version. Note that the default
metadata is tied to the version of the CLI that you're using – it will only change when you move metadata is tied to the version of the CLI that you're using – it will only change when you move
to a new version of the CLI, putting you in control of when the versions of your dependencies to a new version of the CLI, putting you in control of when the versions of your dependencies
may change. may change. A table showing the dependencies and their versions that are included in the default
metadata can be found in the <<appendix-dependency-versions, appendix>>.
......
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:mvn="http://maven.apache.org/POM/4.0.0"
version="1.0">
<xsl:output method="text" encoding="UTF-8" indent="no"/>
<xsl:template match="/">
<xsl:text>|==================================&#xa;</xsl:text>
<xsl:text>| Group ID | Artifact ID | Version&#xa;</xsl:text>
<xsl:for-each select="//mvn:dependency">
<xsl:sort select="mvn:groupId"/>
<xsl:sort select="mvn:artifactId"/>
<xsl:text>| </xsl:text>
<xsl:copy-of select="mvn:groupId"/>
<xsl:text> | </xsl:text>
<xsl:copy-of select="mvn:artifactId"/>
<xsl:text> | </xsl:text>
<xsl:copy-of select="mvn:version"/>
<xsl:text>&#xa;</xsl:text>
</xsl:for-each>
<xsl:text>|==================================</xsl:text>
</xsl:template>
</xsl:stylesheet>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment