Files

28 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# Which Boot test jars does spring-boot-starter-test alone bring in?
# Resolves a throwaway project with the three production starters and ONLY spring-boot-starter-test,
# then lists every spring-boot jar with "test" in its name. Writes output/12-starter-test-only-jars.txt.
set -euo pipefail
cd "$(dirname "$0")/.."
BOOT="$(sed -n '/<artifactId>spring-boot-starter-parent<\/artifactId>/{n;s/.*<version>\(.*\)<\/version>.*/\1/p}' pom.xml)"
TMP=target/starter-test-only
rm -rf "$TMP" && mkdir -p "$TMP"
cat > "$TMP/pom.xml" <<POM
<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion>
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>${BOOT}</version><relativePath/></parent>
<groupId>probe</groupId><artifactId>starter-test-only</artifactId><version>1</version>
<dependencies>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webmvc</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-jpa</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-restclient</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope></dependency>
</dependencies>
</project>
POM
mvn -B -q -f "$TMP/pom.xml" dependency:build-classpath -Dmdep.outputFile=cp.txt > /dev/null 2>&1
{
echo "Spring Boot ${BOOT}: webmvc + data-jpa + restclient starters, and only spring-boot-starter-test for tests"
echo "spring-boot jars with 'test' in the name on that classpath:"
tr ':' '\n' < "$TMP/cp.txt" | sed 's#.*/##' | grep -E '^spring-boot.*test' | sed 's/^/ /'
} > output/12-starter-test-only-jars.txt