From 28090e8a5ff5c3eae3a791ec8c3dafcc54790c34 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Sat, 7 Jun 2014 23:05:51 -0700 Subject: [PATCH] Generate and attach dependency-tree Update spring-boot-versions to generate a dependency-tree file and attach it as an artifact. The file is generated by creating a temporary POM and calling the invoker plugin. The spring-boot-versions POM now depends on all spring-boot-starter-* POMs to ensure that they have been installed before the dependency tree is processes. See gh-1047 --- spring-boot-dependencies/pom.xml | 12 ++ spring-boot-starters/pom.xml | 1 + spring-boot-versions/pom.xml | 178 ++++++++++++++++++ .../src/dependency-tree/pom.xml | 40 ++++ .../groovy/generateDependencyTreePom.groovy | 34 ++++ 5 files changed, 265 insertions(+) create mode 100644 spring-boot-versions/src/dependency-tree/pom.xml create mode 100644 spring-boot-versions/src/main/groovy/generateDependencyTreePom.groovy diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 6cca2f68106..38bc2c3c4e7 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -162,6 +162,12 @@ org.springframework.boot spring-boot-starter 1.1.0.BUILD-SNAPSHOT + + + commons-logging + commons-logging + + org.springframework.boot @@ -292,6 +298,12 @@ org.springframework.boot spring-boot-starter-test 1.1.0.BUILD-SNAPSHOT + + + commons-logging + commons-logging + + org.springframework.boot diff --git a/spring-boot-starters/pom.xml b/spring-boot-starters/pom.xml index 309f13eb059..87c07167df7 100644 --- a/spring-boot-starters/pom.xml +++ b/spring-boot-starters/pom.xml @@ -20,6 +20,7 @@ ${basedir}/.. + spring-boot-starter spring-boot-starter-amqp spring-boot-starter-aop diff --git a/spring-boot-versions/pom.xml b/spring-boot-versions/pom.xml index 94c6c939947..63160430b0a 100644 --- a/spring-boot-versions/pom.xml +++ b/spring-boot-versions/pom.xml @@ -28,6 +28,7 @@ + org.apache.maven.plugins maven-help-plugin @@ -42,6 +43,49 @@ + + org.codehaus.gmavenplus + gmavenplus-plugin + + + + execute + + generate-resources + + + + + + + + + + org.codehaus.groovy + groovy-all + ${groovy.version} + + + + + org.apache.maven.plugins + maven-invoker-plugin + + + generate-dependency-tree + generate-resources + + run + + + ${project.build.directory}/invoker + src/dependency-tree/settings.xml + true + ${basedir}/src/dependency-tree/pom.xml + + + + org.codehaus.mojo xml-maven-plugin @@ -89,6 +133,10 @@ ${project.build.directory}/effective-pom/spring-boot-versions.xml effective-pom + + ${project.build.directory}/dependency-tree/dependency-tree.txt + dependency-tree + @@ -96,4 +144,134 @@ + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-amqp + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-batch + + + org.springframework.boot + spring-boot-starter-data-elasticsearch + + + org.springframework.boot + spring-boot-starter-data-gemfire + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-data-mongodb + + + org.springframework.boot + spring-boot-starter-data-rest + + + org.springframework.boot + spring-boot-starter-data-solr + + + org.springframework.boot + spring-boot-starter-freemarker + + + org.springframework.boot + spring-boot-starter-groovy-templates + + + org.springframework.boot + spring-boot-starter-hornetq + + + org.springframework.boot + spring-boot-starter-integration + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-jetty + + + org.springframework.boot + spring-boot-starter-log4j + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-mobile + + + org.springframework.boot + spring-boot-starter-redis + + + org.springframework.boot + spring-boot-starter-remote-shell + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-social-facebook + + + org.springframework.boot + spring-boot-starter-social-linkedin + + + org.springframework.boot + spring-boot-starter-social-twitter + + + org.springframework.boot + spring-boot-starter-test + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-tomcat + + + org.springframework.boot + spring-boot-starter-velocity + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-websocket + + diff --git a/spring-boot-versions/src/dependency-tree/pom.xml b/spring-boot-versions/src/dependency-tree/pom.xml new file mode 100644 index 00000000000..b100b464509 --- /dev/null +++ b/spring-boot-versions/src/dependency-tree/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-versions + @project.version@ + ../../target/dependency-tree + + spring-boot-versions-dependency-tree + pom + + + + org.apache.maven.plugins + maven-dependency-plugin + + + write-dependencies-tree + generate-resources + + tree + + + @project.build.directory@/dependency-tree/dependency-tree.txt + true + + + + + + + + + spring-ext + http://repo.spring.io/ext-release-local/ + + + diff --git a/spring-boot-versions/src/main/groovy/generateDependencyTreePom.groovy b/spring-boot-versions/src/main/groovy/generateDependencyTreePom.groovy new file mode 100644 index 00000000000..4a931da9ffc --- /dev/null +++ b/spring-boot-versions/src/main/groovy/generateDependencyTreePom.groovy @@ -0,0 +1,34 @@ +// Generate a POM from the effective-pom that can be used to build a complete dependency tree + +import groovy.util.* +import groovy.xml.* + +def effectivePom = new XmlSlurper().parse( + new File(project.build.directory, 'effective-pom/spring-boot-versions.xml')) + +effectivePom.dependencyManagement.dependencies.dependency.findAll{ it.groupId != "org.springframework.boot" }.each { + effectivePom.dependencies.appendNode( it ) +} + +// effectivePom.appendNode(effectivePom.dependencyManagement.dependencies) +effectivePom.parent.replaceNode {} +effectivePom.dependencyManagement.replaceNode {} +effectivePom.build.replaceNode {} +effectivePom.properties.replaceNode {} +effectivePom.repositories.replaceNode {} +effectivePom.pluginRepositories.replaceNode {} +effectivePom.reporting.replaceNode {} + +out = new StreamingMarkupBuilder() +String xmlResult = out.bind { + mkp.declareNamespace("": "http://maven.apache.org/POM/4.0.0") + mkp.yield effectivePom +} + + +def outputDir = new File(project.build.directory, 'dependency-tree'); +outputDir.mkdirs(); +XmlUtil.serialize(xmlResult, new FileWriter(new File(outputDir, 'pom.xml'))) + + +