Skip to content

Commit f2812af

Browse files
committed
Merge branch '1.1.x'
2 parents c601c09 + bcd4c8e commit f2812af

File tree

7 files changed

+67
-11
lines changed

7 files changed

+67
-11
lines changed

spring-boot-integration-tests/src/test/java/org/springframework/boot/gradle/MultiProjectRepackagingTests.java

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@
1717
package org.springframework.boot.gradle;
1818

1919
import java.io.File;
20-
import java.io.IOException;
2120
import java.util.jar.JarFile;
2221

2322
import org.gradle.tooling.ProjectConnection;
24-
import org.junit.BeforeClass;
2523
import org.junit.Test;
2624
import org.springframework.boot.dependency.tools.ManagedDependencies;
2725

@@ -38,21 +36,31 @@ public class MultiProjectRepackagingTests {
3836
private static final String BOOT_VERSION = ManagedDependencies.get()
3937
.find("spring-boot").getVersion();
4038

41-
private static ProjectConnection project;
42-
43-
@BeforeClass
44-
public static void createProject() throws IOException {
45-
project = new ProjectCreator().createProject("multi-project-repackage");
46-
}
47-
4839
@Test
4940
public void repackageWithTransitiveFileDependency() throws Exception {
41+
ProjectConnection project = new ProjectCreator()
42+
.createProject("multi-project-transitive-file-dependency");
5043
project.newBuild().forTasks("clean", "build")
51-
.withArguments("-PbootVersion=" + BOOT_VERSION, "-Prepackage=true").run();
52-
File buildLibs = new File("target/multi-project-repackage/main/build/libs");
44+
.withArguments("-PbootVersion=" + BOOT_VERSION).run();
45+
File buildLibs = new File(
46+
"target/multi-project-transitive-file-dependency/main/build/libs");
5347
JarFile jarFile = new JarFile(new File(buildLibs, "main.jar"));
5448
assertThat(jarFile.getEntry("lib/commons-logging-1.1.3.jar"), notNullValue());
5549
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
5650
jarFile.close();
5751
}
52+
53+
@Test
54+
public void repackageWithCommonFileDependency() throws Exception {
55+
ProjectConnection project = new ProjectCreator()
56+
.createProject("multi-project-common-file-dependency");
57+
project.newBuild().forTasks("clean", "build")
58+
.withArguments("-PbootVersion=" + BOOT_VERSION).run();
59+
File buildLibs = new File(
60+
"target/multi-project-common-file-dependency/build/libs");
61+
JarFile jarFile = new JarFile(new File(buildLibs,
62+
"multi-project-common-file-dependency.jar"));
63+
assertThat(jarFile.getEntry("lib/foo.jar"), notNullValue());
64+
jarFile.close();
65+
}
5866
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
buildscript {
2+
repositories {
3+
mavenLocal()
4+
}
5+
dependencies {
6+
classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.bootVersion}"
7+
}
8+
}
9+
10+
subprojects {
11+
apply plugin: 'java'
12+
13+
dependencies {
14+
compile rootProject.files {'lib/foo.jar'}
15+
}
16+
}
17+
18+
apply plugin: 'spring-boot'
19+
20+
springBoot {
21+
mainClass = 'foo.bar.Baz'
22+
}
23+
24+
dependencies {
25+
compile project(':one')
26+
compile project(':two')
27+
}
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
include 'one'
3+
include 'two'

spring-boot-tools/spring-boot-gradle-plugin/src/main/groovy/org/springframework/boot/gradle/repackage/ProjectLibraries.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,23 @@ public String getName() {
199199
return name;
200200
}
201201

202+
@Override
203+
public int hashCode() {
204+
return getFile().hashCode();
205+
}
206+
207+
@Override
208+
public boolean equals(Object obj) {
209+
if (obj instanceof GradleLibrary) {
210+
return getFile().equals(((GradleLibrary) obj).getFile());
211+
}
212+
return false;
213+
}
214+
215+
@Override
216+
public String toString() {
217+
return getFile().getAbsolutePath();
218+
}
202219
}
203220

204221
/**

0 commit comments

Comments
 (0)