File tree 3 files changed +88
-0
lines changed
spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest
java/org/springframework/boot/maven
projects/build-image-with-repackage
3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,31 @@ void whenBuildImageIsInvokedWithoutRepackageTheArchiveIsRepackagedOnTheFly(Maven
65
65
});
66
66
}
67
67
68
+ @ TestTemplate
69
+ void whenBuildImageIsInvokedWithRepackageTheExistingArchiveIsUsed (MavenBuild mavenBuild ) {
70
+ mavenBuild .project ("build-image-with-repackage" ).goals ("package" ).prepare (this ::writeLongNameResource )
71
+ .execute ((project ) -> {
72
+ File jar = new File (project , "target/build-image-with-repackage-0.0.1.BUILD-SNAPSHOT.jar" );
73
+ assertThat (jar ).isFile ();
74
+ File original = new File (project ,
75
+ "target/build-image-with-repackage-0.0.1.BUILD-SNAPSHOT.jar.original" );
76
+ assertThat (original ).isFile ();
77
+ String log = buildLog (project );
78
+ System .out .println (log );
79
+ assertThat (log ).contains ("Building image" ).contains ("paketo-buildpacks/builder" )
80
+ .contains ("docker.io/library/build-image-with-repackage:0.0.1.BUILD-SNAPSHOT" )
81
+ .contains ("Successfully built image" );
82
+ ImageReference imageReference = ImageReference .of (ImageName .of ("build-image-with-repackage" ),
83
+ "0.0.1.BUILD-SNAPSHOT" );
84
+ try (GenericContainer <?> container = new GenericContainer <>(imageReference .toString ())) {
85
+ container .waitingFor (Wait .forLogMessage ("Launched\\ n" , 1 )).start ();
86
+ }
87
+ finally {
88
+ removeImage (imageReference );
89
+ }
90
+ });
91
+ }
92
+
68
93
@ TestTemplate
69
94
void whenBuildImageIsInvokedWithCustomImageName (MavenBuild mavenBuild ) {
70
95
mavenBuild .project ("build-image-custom-name" ).goals ("package" )
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" >
4
+ <modelVersion >4.0.0</modelVersion >
5
+ <groupId >org.springframework.boot.maven.it</groupId >
6
+ <artifactId >build-image-with-repackage</artifactId >
7
+ <version >0.0.1.BUILD-SNAPSHOT</version >
8
+ <properties >
9
+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
10
+ <maven .compiler.source>@java.version@</maven .compiler.source>
11
+ <maven .compiler.target>@java.version@</maven .compiler.target>
12
+ </properties >
13
+ <build >
14
+ <plugins >
15
+ <plugin >
16
+ <groupId >@project.groupId@</groupId >
17
+ <artifactId >@project.artifactId@</artifactId >
18
+ <version >@project.version@</version >
19
+ <executions >
20
+ <execution >
21
+ <id >repackage</id >
22
+ <goals >
23
+ <goal >repackage</goal >
24
+ </goals >
25
+ </execution >
26
+ <execution >
27
+ <goals >
28
+ <goal >build-image</goal >
29
+ </goals >
30
+ </execution >
31
+ </executions >
32
+ </plugin >
33
+ </plugins >
34
+ </build >
35
+ </project >
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright 2012-2020 the original author or authors.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * https://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package org .test ;
18
+
19
+ public class SampleApplication {
20
+
21
+ public static void main (String [] args ) throws Exception {
22
+ System .out .println ("Launched" );
23
+ synchronized (args ) {
24
+ args .wait (); // Prevent exit"
25
+ }
26
+ }
27
+
28
+ }
You can’t perform that action at this time.
0 commit comments