Merge branch '2.1.x'

This commit is contained in:
Marcin Grzejszczak
2019-08-23 16:41:33 +02:00
5 changed files with 20 additions and 10 deletions

View File

@@ -82,7 +82,7 @@ class ContractsCopyTask extends DefaultTask {
@TaskAction
void sync() {
File contractsDirectory = config.contractsDirectory.get().asFile
String contractsRepository = config.contractsRepository
String contractsRepository = config.contractsRepository.get()
throwExceptionWhenFailOnNoContracts(contractsDirectory, contractsRepository)
String antPattern = "${config.includedRootFolderAntPattern.get()}*.*"
String slashSeparatedGroupId = project.group.toString().replace(".", File.separator)

View File

@@ -47,6 +47,10 @@ public class GenerateStubsMojo extends AbstractMojo {
required = true)
private File projectBuildDirectory;
@Parameter(defaultValue = "${project.build.finalName}", readonly = true,
required = true)
private String projectFinalName;
@Parameter(property = "stubsDirectory",
defaultValue = "${project.build.directory}/stubs")
private File outputDirectory;
@@ -112,9 +116,14 @@ public class GenerateStubsMojo extends AbstractMojo {
stubsJarFile);
}
private File createStubJar(File stubsOutputDir) throws MojoFailureException {
String stubArchiveName = this.project.getBuild().getFinalName() + "-"
+ this.classifier + ".jar";
private File createStubJar(File stubsOutputDir)
throws MojoFailureException, MojoExecutionException {
if (!stubsOutputDir.exists()) {
throw new MojoExecutionException("Stubs could not be found: ["
+ stubsOutputDir.getAbsolutePath()
+ "] .\nPlease make sure that spring-cloud-contract:convert was invoked");
}
String stubArchiveName = this.projectFinalName + "-" + this.classifier + ".jar";
File stubsJarFile = new File(this.projectBuildDirectory, stubArchiveName);
String[] excludes = excludes();
getLog().info("Files matching this pattern will be excluded from "

View File

@@ -148,7 +148,7 @@ public class PluginUnitTest {
public void shouldGenerateStubs() throws Exception {
File basedir = this.resources.getBasedir("generatedStubs");
this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests());
assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
assertFilesPresent(basedir, "target/sample-project-stubs.jar");
}
@Test
@@ -156,7 +156,7 @@ public class PluginUnitTest {
File basedir = this.resources.getBasedir("generatedStubs");
this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests(),
newParameter("attachContracts", "false"));
assertFilesPresent(basedir, "target/sample-project-0.1-stubs.jar");
assertFilesPresent(basedir, "target/sample-project-stubs.jar");
// FIXME: add assertion for jar content
}
@@ -165,7 +165,7 @@ public class PluginUnitTest {
File basedir = this.resources.getBasedir("generatedStubs");
this.maven.executeMojo(basedir, "generateStubs", defaultPackageForTests(),
newParameter("classifier", "foo"));
assertFilesPresent(basedir, "target/sample-project-0.1-foo.jar");
assertFilesPresent(basedir, "target/sample-project-foo.jar");
}
@Test

View File

@@ -27,6 +27,7 @@
<version>0.1</version>
<build>
<finalName>${project.name}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.cloud</groupId>

View File

@@ -19,12 +19,12 @@ package org.springframework.cloud.contract.verifier.config.framework;
import java.util.List;
/**
* @deprecated appropriate implementations of <code>org.springframework.cloud.contract.verifier.builder.Visitor</code>
* should be used instead.
* @deprecated appropriate implementations of
* <code>org.springframework.cloud.contract.verifier.builder.Visitor</code> should be used
* instead.
*
* Defines elements characteristic of a given test framework to be used during test class
* construction.
*
* @author Olga Maciaszek-Sharma
* @since 2.1.0
*/