Removes Gradle plugin's src/test/resources/contracts checking; fixes gh-1848

This commit is contained in:
Marcin Grzejszczak
2022-11-18 18:53:52 +01:00
parent edc441024e
commit 44977aa9e3
20 changed files with 79 additions and 90 deletions

View File

@@ -171,7 +171,7 @@ public class ContractVerifierExtension implements Serializable {
/**
* A package that contains all the base clases for generated tests. If your contract
* resides in a location {@code src/test/resources/contracts/com/example/v1/} and you
* resides in a location {@code src/contractTest/resources/contracts/com/example/v1/} and you
* provide the {@code packageWithBaseClasses} value to
* {@code com.example.contracts.base} then we will search for a test source file that
* will have the package {@code com.example.contracts.base} and name

View File

@@ -249,8 +249,8 @@ class ContractsCopyTask extends DefaultTask {
}
return;
}
if (failOnNoContracts.get() && (!file.exists() || file.listFiles().length == 0)) {
String path = file.getAbsolutePath();
if (failOnNoContracts.get() && (file == null || !file.exists() || file.listFiles().length == 0)) {
String path = file != null ? file.getAbsolutePath() : "";
throw new GradleException("Contracts could not be found: [" + path
+ "]\nPlease make sure that the contracts were defined, or set the [failOnNoContracts] flag to [false]");
}
@@ -541,4 +541,4 @@ class ContractsCopyTask extends DefaultTask {
return str;
}
}
}

View File

@@ -344,8 +344,8 @@ public class SpringCloudContractVerifierGradlePlugin implements Plugin<Project>
.dir("src/test/resources/contracts");
if (legacyContractsDslDir.getAsFile().exists()) {
project.getLogger().warn(
"Spring Cloud Contract Verifier Plugin: Locating contracts in <src/test/resources/contracts> is deprecated and will be removed in a future release. Please move them to <src/contractTest/resources/contracts>.");
return legacyContractsDslDir;
"Spring Cloud Contract Verifier Plugin: Locating contracts in <src/test/resources/contracts> has been removed. Please move them to <src/contractTest/resources/contracts>. This warning message will be removed in a future release.");
return contractsDslDir;
}
else {
return null;