File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 3 files changed +88
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,31 @@ void whenBuildImageIsInvokedWithoutRepackageTheArchiveIsRepackagedOnTheFly(Maven
6868 });
6969 }
7070
71+ @ TestTemplate
72+ void whenBuildImageIsInvokedWithRepackageTheExistingArchiveIsUsed (MavenBuild mavenBuild ) {
73+ mavenBuild .project ("build-image-with-repackage" ).goals ("package" ).prepare (this ::writeLongNameResource )
74+ .execute ((project ) -> {
75+ File jar = new File (project , "target/build-image-with-repackage-0.0.1.BUILD-SNAPSHOT.jar" );
76+ assertThat (jar ).isFile ();
77+ File original = new File (project ,
78+ "target/build-image-with-repackage-0.0.1.BUILD-SNAPSHOT.jar.original" );
79+ assertThat (original ).isFile ();
80+ String log = buildLog (project );
81+ System .out .println (log );
82+ assertThat (log ).contains ("Building image" ).contains ("paketo-buildpacks/builder" )
83+ .contains ("docker.io/library/build-image-with-repackage:0.0.1.BUILD-SNAPSHOT" )
84+ .contains ("Successfully built image" );
85+ ImageReference imageReference = ImageReference .of (ImageName .of ("build-image-with-repackage" ),
86+ "0.0.1.BUILD-SNAPSHOT" );
87+ try (GenericContainer <?> container = new GenericContainer <>(imageReference .toString ())) {
88+ container .waitingFor (Wait .forLogMessage ("Launched\\ n" , 1 )).start ();
89+ }
90+ finally {
91+ removeImage (imageReference );
92+ }
93+ });
94+ }
95+
7196 @ TestTemplate
7297 void whenBuildImageIsInvokedWithCustomImageName (MavenBuild mavenBuild ) {
7398 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