|
|
|
|
@ -17,11 +17,9 @@
@@ -17,11 +17,9 @@
|
|
|
|
|
package org.springframework.boot.gradle; |
|
|
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.util.jar.JarFile; |
|
|
|
|
|
|
|
|
|
import org.gradle.tooling.ProjectConnection; |
|
|
|
|
import org.junit.BeforeClass; |
|
|
|
|
import org.junit.Test; |
|
|
|
|
import org.springframework.boot.dependency.tools.ManagedDependencies; |
|
|
|
|
|
|
|
|
|
@ -38,21 +36,31 @@ public class MultiProjectRepackagingTests {
@@ -38,21 +36,31 @@ public class MultiProjectRepackagingTests {
|
|
|
|
|
private static final String BOOT_VERSION = ManagedDependencies.get() |
|
|
|
|
.find("spring-boot").getVersion(); |
|
|
|
|
|
|
|
|
|
private static ProjectConnection project; |
|
|
|
|
|
|
|
|
|
@BeforeClass |
|
|
|
|
public static void createProject() throws IOException { |
|
|
|
|
project = new ProjectCreator().createProject("multi-project-repackage"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void repackageWithTransitiveFileDependency() throws Exception { |
|
|
|
|
ProjectConnection project = new ProjectCreator() |
|
|
|
|
.createProject("multi-project-transitive-file-dependency"); |
|
|
|
|
project.newBuild().forTasks("clean", "build") |
|
|
|
|
.withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run(); |
|
|
|
|
File buildLibs = new File("target/multi-project-repackage/main/build/libs"); |
|
|
|
|
.withArguments("-PbootVersion=" + BOOT_VERSION).run(); |
|
|
|
|
File buildLibs = new File( |
|
|
|
|
"target/multi-project-transitive-file-dependency/main/build/libs"); |
|
|
|
|
JarFile jarFile = new JarFile(new File(buildLibs, "main.jar")); |
|
|
|
|
assertThat(jarFile.getEntry("lib/commons-logging-1.1.3.jar"), notNullValue()); |
|
|
|
|
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue()); |
|
|
|
|
jarFile.close(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
public void repackageWithCommonFileDependency() throws Exception { |
|
|
|
|
ProjectConnection project = new ProjectCreator() |
|
|
|
|
.createProject("multi-project-common-file-dependency"); |
|
|
|
|
project.newBuild().forTasks("clean", "build") |
|
|
|
|
.withArguments("-PbootVersion=" + BOOT_VERSION).run(); |
|
|
|
|
File buildLibs = new File( |
|
|
|
|
"target/multi-project-common-file-dependency/build/libs"); |
|
|
|
|
JarFile jarFile = new JarFile(new File(buildLibs, |
|
|
|
|
"multi-project-common-file-dependency.jar")); |
|
|
|
|
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue()); |
|
|
|
|
jarFile.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|