Skip to content

Commit

Permalink
Apply single jar fix in non uberJar case as well
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Mar 12, 2019
1 parent b086ce0 commit 1b297bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,14 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException {
log.warn("Unable to set proper permissions on " + runnerJar);
}

// when using uberJar, we rename the standard jar to include the .original suffix
// we rename the standard jar to include the .original suffix
// this greatly aids tools (such as s2i) that look for a single jar in the output directory to work OOTB
if (uberJar) {
try {
Path originalFile = outputDir.resolve(finalName + ".jar.original");
Files.deleteIfExists(originalFile);
Files.move(outputDir.resolve(finalName + ".jar"), originalFile);
} catch (IOException e) {
throw new AppCreatorException("Unable to build uberjar", e);
}
try {
Path originalFile = outputDir.resolve(finalName + ".jar.original");
Files.deleteIfExists(originalFile);
Files.move(outputDir.resolve(finalName + ".jar"), originalFile);
} catch (IOException e) {
throw new AppCreatorException("Unable to build uberjar", e);
}

ctx.pushOutcome(RunnerJarOutcome.class, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public void testPackageWorksWhenUberjarIsFalse()
assertThat(result.getProcess().waitFor()).isEqualTo(0);

final File targetDir = getTargetDir();
assertThat(getNumberOfFilesEndingWith(targetDir, ".jar")).isEqualTo(2);
assertThat(getNumberOfFilesEndingWith(targetDir, ".jar")).isEqualTo(1);
assertThat(getNumberOfFilesEndingWith(targetDir, ".original")).isEqualTo(1);
}

@Test
Expand Down

0 comments on commit 1b297bf

Please sign in to comment.