Port the build to Gradle

Closes gh-19609
Closes gh-19608
This commit is contained in:
Andy Wilkinson
2020-01-10 13:48:43 +00:00
parent abe95fa8a7
commit ce99db1902
974 changed files with 17108 additions and 26596 deletions

View File

@@ -0,0 +1,37 @@
plugins {
id 'java-library'
id 'org.springframework.boot.conventions'
}
description = 'Spring Boot Testing Support'
dependencies {
compileOnly "com.datastax.cassandra:cassandra-driver-core"
compileOnly "javax.servlet:javax.servlet-api"
compileOnly "junit:junit"
compileOnly "org.junit.jupiter:junit-jupiter"
compileOnly "org.junit.platform:junit-platform-engine"
compileOnly "org.mockito:mockito-core"
compileOnly "org.neo4j:neo4j-ogm-core"
compileOnly "org.springframework:spring-context"
compileOnly "org.springframework.data:spring-data-redis"
compileOnly "org.testcontainers:testcontainers"
implementation enforcedPlatform(project(path: ":spring-boot-project:spring-boot-parent"))
implementation "org.apache.maven.resolver:maven-resolver-connector-basic"
implementation "org.apache.maven.resolver:maven-resolver-impl"
implementation "org.apache.maven:maven-resolver-provider"
implementation("org.apache.maven.resolver:maven-resolver-transport-http") {
exclude group: 'org.slf4j', module: 'jcl-over-slf4j'
}
implementation "org.assertj:assertj-core"
implementation "org.hamcrest:hamcrest-core"
implementation "org.hamcrest:hamcrest-library"
implementation "org.springframework:spring-core"
testImplementation "org.junit.jupiter:junit-jupiter"
testImplementation "org.springframework:spring-context"
testRuntimeOnly 'org.hibernate.validator:hibernate-validator'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

View File

@@ -1,149 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-tools</artifactId>
<version>${revision}</version>
</parent>
<artifactId>spring-boot-test-support</artifactId>
<name>Spring Boot Testing Support</name>
<description>Spring Boot Testing Support</description>
<properties>
<main.basedir>${basedir}/../../..</main.basedir>
</properties>
<scm>
<url>${git.url}</url>
<connection>${git.connection}</connection>
<developerConnection>${git.developerConnection}</developerConnection>
</scm>
<dependencies>
<!-- Compile -->
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-resolver-provider</artifactId>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<exclusions>
<exclusion>
<artifactId>jcl-over-slf4j</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
<!-- Optional -->
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-core</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<optional>true</optional>
</dependency>
<!-- Provided -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -40,7 +40,9 @@ public class BuildOutput {
public File getTestClassesLocation() {
try {
File location = new File(this.testClass.getProtectionDomain().getCodeSource().getLocation().toURI());
if (location.getPath().endsWith(path("target", "test-classes"))) {
if (location.getPath().endsWith(path("bin", "test")) || location.getPath().endsWith(path("bin", "intTest"))
|| location.getPath().endsWith(path("build", "classes", "java", "test"))
|| location.getPath().endsWith(path("build", "classes", "java", "intTest"))) {
return location;
}
throw new IllegalStateException("Unexpected test classes location '" + location + "'");
@@ -56,9 +58,16 @@ public class BuildOutput {
*/
public File getTestResourcesLocation() {
File testClassesLocation = getTestClassesLocation();
if (testClassesLocation.getPath().endsWith(path("target", "test-classes"))) {
if (testClassesLocation.getPath().endsWith(path("bin", "test"))
|| testClassesLocation.getPath().endsWith(path("bin", "intTest"))) {
return testClassesLocation;
}
if (testClassesLocation.getPath().endsWith(path("build", "classes", "java", "test"))) {
return new File(testClassesLocation.getParentFile().getParentFile().getParentFile(), "resources/test");
}
if (testClassesLocation.getPath().endsWith(path("build", "classes", "java", "intTest"))) {
return new File(testClassesLocation.getParentFile().getParentFile().getParentFile(), "resources/intTest");
}
throw new IllegalStateException(
"Cannot determine test resources location from classes location '" + testClassesLocation + "'");
}
@@ -68,7 +77,7 @@ public class BuildOutput {
* @return root location
*/
public File getRootLocation() {
return getTestClassesLocation().getParentFile();
return new File("build");
}
private String path(String... components) {