Merge branch '2.1.x'
This commit is contained in:
@@ -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 "
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
<version>0.1</version>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
|
||||
Reference in New Issue
Block a user