Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
899e8e18
Commit
899e8e18
authored
Aug 18, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.3.x'
Closes gh-23001
parents
cfc053d7
f7452b93
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
Repackager.java
...ava/org/springframework/boot/loader/tools/Repackager.java
+1
-0
RepackagerTests.java
...rg/springframework/boot/loader/tools/RepackagerTests.java
+19
-0
No files found.
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/Repackager.java
View file @
899e8e18
...
@@ -101,6 +101,7 @@ public class Repackager extends Packager {
...
@@ -101,6 +101,7 @@ public class Repackager extends Packager {
public
void
repackage
(
File
destination
,
Libraries
libraries
,
LaunchScript
launchScript
,
FileTime
lastModifiedTime
)
public
void
repackage
(
File
destination
,
Libraries
libraries
,
LaunchScript
launchScript
,
FileTime
lastModifiedTime
)
throws
IOException
{
throws
IOException
{
Assert
.
isTrue
(
destination
!=
null
&&
!
destination
.
isDirectory
(),
"Invalid destination"
);
Assert
.
isTrue
(
destination
!=
null
&&
!
destination
.
isDirectory
(),
"Invalid destination"
);
getLayout
();
// get layout early
if
(
lastModifiedTime
!=
null
&&
getLayout
()
instanceof
War
)
{
if
(
lastModifiedTime
!=
null
&&
getLayout
()
instanceof
War
)
{
throw
new
IllegalStateException
(
"Reproducible repackaging is not supported with war packaging"
);
throw
new
IllegalStateException
(
"Reproducible repackaging is not supported with war packaging"
);
}
}
...
...
spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/test/java/org/springframework/boot/loader/tools/RepackagerTests.java
View file @
899e8e18
...
@@ -139,6 +139,15 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
...
@@ -139,6 +139,15 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
assertThat
(
hasLauncherClasses
(
this
.
destination
)).
isTrue
();
assertThat
(
hasLauncherClasses
(
this
.
destination
)).
isTrue
();
}
}
@Test
void
layoutFactoryGetsOriginalFile
()
throws
Exception
{
this
.
testJarFile
.
addClass
(
"a/b/C.class"
,
ClassWithMainMethod
.
class
);
Repackager
repackager
=
createRepackager
(
this
.
testJarFile
.
getFile
(),
false
);
repackager
.
setLayoutFactory
(
new
TestLayoutFactory
());
repackager
.
repackage
(
this
.
destination
,
NO_LIBRARIES
);
assertThat
(
hasLauncherClasses
(
this
.
destination
)).
isTrue
();
}
@Test
@Test
void
addLauncherScript
()
throws
Exception
{
void
addLauncherScript
()
throws
Exception
{
this
.
testJarFile
.
addClass
(
"a/b/C.class"
,
ClassWithMainMethod
.
class
);
this
.
testJarFile
.
addClass
(
"a/b/C.class"
,
ClassWithMainMethod
.
class
);
...
@@ -266,4 +275,14 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
...
@@ -266,4 +275,14 @@ class RepackagerTests extends AbstractPackagerTests<Repackager> {
}
}
static
class
TestLayoutFactory
implements
LayoutFactory
{
@Override
public
Layout
getLayout
(
File
source
)
{
assertThat
(
source
.
length
()).
isGreaterThan
(
0
);
return
new
DefaultLayoutFactory
().
getLayout
(
source
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment