Merge branch '1.2.x'

This commit is contained in:
Andy Wilkinson
2015-03-04 13:43:25 +00:00
8 changed files with 138 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ import java.util.jar.Manifest;
* '{@literal java -jar}'.
*
* @author Phillip Webb
* @author Andy Wilkinson
*/
public class Repackager {
@@ -157,7 +158,6 @@ public class Repackager {
try {
final Set<String> seen = new HashSet<String>();
writer.writeManifest(buildManifest(sourceJar));
writer.writeEntries(sourceJar);
libraries.doWithLibraries(new LibraryCallback() {
@Override
public void library(Library library) throws IOException {
@@ -176,7 +176,7 @@ public class Repackager {
}
}
});
writer.writeEntries(sourceJar);
if (this.layout.isExecutable()) {
writer.writeLoaderClasses();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2014 the original author or authors.
* Copyright 2012-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -280,6 +280,8 @@ public class RepackagerTests {
final File libNonJarFile = this.temporaryFolder.newFile();
FileCopyUtils.copy(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }, libNonJarFile);
this.testJarFile.addClass("a/b/C.class", ClassWithMainMethod.class);
this.testJarFile.addFile("lib/" + libJarFileToUnpack.getName(),
libJarFileToUnpack);
File file = this.testJarFile.getFile();
Repackager repackager = new Repackager(file);
repackager.repackage(new Libraries() {