194 Commits

Author SHA1 Message Date
Konrado85
9f4c39c985 Change PropertiesLauncher equals method to use URI
See gh-20872
2020-04-13 13:55:17 +02:00
Phillip Webb
1640add8be Don't use Assert class from loader
Remove the use of `Assert` since it's unavailable that early.
2020-04-07 12:09:43 -07:00
Phillip Webb
df58b9baa2 Use YAML compatible classpath.idx format
Update the `classpath.idx` format to align with `layers.idx` and allow
third-parties can parse it as YAML

Closes gh-20861
2020-04-06 19:18:22 -07:00
Oleg Zhurakousky
9f75f30856 Change call to createClassLoader(URL) from 'super' to 'this'
ExecutableArchiveLauncher.createClassLoader(Iterator) calls
createClassLoader(URL) method with 'super'. This means overriding
createClassLoader(URL) is not possible without also overriding
createClassLoader(Iterator). The switch to 'this' enables that.

See gh-20851
2020-04-06 10:40:37 -07:00
Madhura Bhave
4e3cdf936f Support flat jar layering with Maven
Update the Maven plugin so that layered jars now use the regular "flat"
format. The layers.idx file now describes which layer each file should
be placed.

See gh-20813

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2020-04-03 00:34:27 -07:00
Madhura Bhave
ad164269e9 Update classpath index to use jar name instead of full path
See gh-20564
2020-03-25 10:46:59 -07:00
Phillip Webb
9a33a723fe Update copyright year of changed files 2020-03-23 14:15:08 -07:00
Madhura Bhave
3e8ee2a296 Add missing package-info.json
Closes gh-20516
2020-03-16 16:11:02 -07:00
dreis2211
53e8e49552 Fix JarFileTests for multi-release JARs on JDK14
See gh-20180
2020-03-07 16:55:02 +01:00
dreis2211
4f824bf9ad Fix duplicate words
See gh-20210
2020-02-18 13:34:56 +01:00
zhangt2333
e2d87a89d0 Polish
See gh-20192
2020-02-16 17:19:18 +01:00
Madhura Bhave
bceed1305f Jar files added after build time should be added to classpath
Fixes gh-19973
2020-01-30 15:38:49 -08:00
dreis2211
d8e2349e47 Use Supplier variants of Assert
See gh-19864
2020-01-28 15:04:11 +01:00
Stephane Nicoll
e044817fe7 Migrate remaining use of ClassLoader.loadClass to Class.forName
Closes gh-19824
2020-01-23 13:15:45 +01:00
Phillip Webb
2b83edeb27 Fix jarmode support in unexploded jars
Update `LaunchedURLClassLoader` to ensure that the `JarModeLauncher`
is created in the correct classloader.

Prior to this commit the launcher was created by the application
classloader and did not have access to any of the required
`org.springframework` classes.

See gh-19848
2020-01-22 23:07:18 -08:00
Phillip Webb
77bbe089b2 Update copyright year of changed files 2020-01-22 20:24:23 -08:00
Phillip Webb
951d0b0fdf Fix exploded jar classloader issues
Fix a bug in `ExplodedURLClassLoader` and merge the code into the
existing `LaunchedURLClassLoader` class. Also polish a few method
names relating to layer support.

See gh-19848
See gh-19767
2020-01-22 12:56:14 -08:00
Phillip Webb
73a42050d6 Add jarmode support to the loader code
Update the `Launcher` class to allow a packaged jar to be  launched in
a different mode. The launcher now checks for a `jarmode` property and
attempts to find a `JarMode` implementation using the standard
`spring.factories` mechanism.

Closes gh-19848
2020-01-22 01:23:11 -08:00
Madhura Bhave
e9d61bac75 Support generation and loading of layered jars
Support an alternative fat jar format that is more amenable to Docker
image layers.

The new format arranges files in the following structure:

	BOOT-INF/
	  layers/
	    <layer-name #1>
	      /classes
	      /lib
	    <layer-name #2>
	      /classes
	      /lib

The `BOOT-INF/layers.idx` file provides the names of the layers and the
order in which they should be added (starting with the least changed).

The `JarLauncher` class can load layered jars in both fat and exploded
forms.

Closes gh-19767

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2020-01-15 23:32:58 -08:00
Madhura Bhave
45b1ab46c3 Add classpath index support for exploded archives
Update the `Repackager` class so that an additional `classpath.idx` file
is written into the jar that provides the original order of the
classpath. The `JarLauncher` class now uses this file when running as
an exploded archive to ensure that the classpath order is the same as
when running from the far jar.

Closes gh-9128

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2020-01-15 23:31:17 -08:00
Phillip Webb
ad72f86bdb Polish loader and loader-tools
Polish and refactor `spring-boot-loader` and `spring-boot-loader-tools`
to make it easier to add indexing and layering support.

Closes gh-19766
2020-01-15 23:29:11 -08:00
Andy Wilkinson
56e30258fb Merge branch '2.2.x' 2020-01-15 20:45:42 +00:00
Andy Wilkinson
b7e250eb04 Merge branch '2.1.x' into 2.2.x 2020-01-15 20:45:24 +00:00
Andy Wilkinson
ebebe09a9d Fix file handle leak in JarFileTests
The JarFile was not being closed which linked a file handle and caused
a test failure on Windows.

The local variable has been renamed as, when declared in a
try-with-resources, Checkstyle was confused by the shadowing of the
jarFile field and required references to jarFile within the try-block
the be prefixed with this.

See gh-19595
2020-01-15 20:43:54 +00:00
Madhura Bhave
aae1151f12 Merge branch '2.2.x'
Closes gh-19714
2020-01-14 18:52:35 -08:00
Madhura Bhave
3bf943d597 Merge branch '2.1.x' into 2.2.x
Closes gh-19713
2020-01-14 18:51:50 -08:00
Madhura Bhave
91e459a5d4 Polish "Limit ChronoField values to their range"
See gh-19595
2020-01-14 18:26:01 -08:00
Dmytro Nosan
9bc68b9877 Limit ChronoField values to their range
See gh-19595
2020-01-14 18:25:28 -08:00
Andy Wilkinson
244b5391bc Fix file handle leak in JarFileArchiveTests
Closes gh-19655
2020-01-14 17:20:29 +00:00
Phillip Webb
862462b791 Update copyright year of changed files 2020-01-13 17:04:19 -08:00
Andy Wilkinson
ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
2020-01-10 14:15:35 +00:00
Stephane Nicoll
2c1e81adf0 Polish 2019-12-26 10:42:40 +01:00
Phillip Webb
93d9147864 Add deprecation documentation to Archive.iterator
See gh-16655
2019-12-19 16:52:47 -08:00
Andy Wilkinson
ef2eb2f652 Remove accidental usage of Plexus's CollectionUtils
See gh-16655 and 8f5777cf
2019-12-14 17:42:26 +00:00
dreis2211
3be05f61e1 Fix unknown tag in javadoc
See gh-19364
2019-12-12 17:04:25 -08:00
Madhura Bhave
8f5777cf9e Optimize JarLauncher when used with exploded jar
- Previously, we would create a JarFileArchive for all nested jars.
This was an additional overhead. We only need to create a JarFileArchive
for jars that can have nested jars in them. For all other jars we only need
the URL to build the classpath.
- While iterating over nested entries in the exploded jar, we only need to
look at BOOT-INF and we can skip any entry that does not match that.

Closes gh-16655

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2019-12-12 14:33:48 -08:00
Johnny Lim
ea51947741 Use try-with-resources blocks in JarFileArchiveTests
See gh-18883
2019-11-06 08:01:50 +01:00
Stephane Nicoll
8108b556ad Fix resource cleanup in test
Closes gh-18569
2019-10-13 13:41:50 +02:00
Andy Wilkinson
02ac089767 Polish "Support zip64 jars"
See gh-16091
2019-09-20 14:35:19 +01:00
Camille Vienot
1917e1eac5 Support zip64 jars
See gh-16091
2019-09-20 12:44:04 +01:00
Andy Wilkinson
1b237de5f5 Use Awaitility in our own tests
Closes gh-18227
2019-09-13 20:50:14 +01:00
Andy Wilkinson
ff1983c9ae Merge branch '2.1.x'
Closes gh-18168
2019-09-06 14:38:45 +01:00
Andy Wilkinson
795c2f225f Support getComment() on a nested JarFile
Previously, calling getComment() on a nested jar file would result
in the outer jar file's comment being returned.

This commit updates the loader's JarFile to read the file's comment
from the central directory end record and return it from getComment().

Fixes gh-18128
2019-09-06 14:29:48 +01:00
thelproad
9c1f503e46 Simplify if statements
See gh-17884
2019-08-17 06:50:32 +02:00
dreis2211
b605cddb10 Polish some Collections API calls
See gh-17825
2019-08-11 10:36:10 +02:00
Madhura Bhave
8a9c60a29a Merge branch '2.1.x' 2019-08-08 11:52:50 -07:00
Madhura Bhave
541d3c4853 Fix typo 2019-08-08 11:52:05 -07:00
Phillip Webb
8bc780762a Merge branch '2.1.x' 2019-07-24 11:42:48 +01:00
Phillip Webb
fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 2019-07-24 11:41:32 +01:00
Phillip Webb
913e831f4e Merge '1.5.x' into 2.0.x 2019-07-24 11:39:58 +01:00