182 Commits

Author SHA1 Message Date
Andy Wilkinson
e94f8bba62 Ensure that upstream jars have been built
See gh-25835
2021-03-30 20:51:33 +01:00
Andy Wilkinson
ca9a619259 Defer processing of zipTree source until execution time
Closes gh-25835
2021-03-30 20:41:46 +01:00
Phillip Webb
9c8a97809d Consistent use of @deprecated since
Restore the patch version number for consistency with `@since`
tags.

See gh-25808
2021-03-30 09:20:30 -07:00
Phillip Webb
26dd1b9a26 Update deprecations with for removal targets
Update all deprecation tags to include a removal target.

Closes gh-25808
2021-03-29 15:44:58 -07:00
Scott Frederick
3ad5f1013a Fix Maven image building with classifiers
Fixes gh-25736
2021-03-26 11:36:38 -05:00
Phillip Webb
82127fdaa3 Update copyright year of changed files 2021-03-23 12:50:49 -07:00
Scott Frederick
e4fa39df01 Fail fast when finalName is misconfigured
When the `finalName` parameter is incorrectly set in the Spring Boot
Maven plugin configuration instead of in the `build` configuration, the
repackaged and original archive files are not named as expected. Prior
to this commit, the image building goal would detect this error
condition and throw an exception late in the process of creating the
build container, leaving the container in an unstable state. This
commit changes the image building goal to detect this condition early,
before attempting to create the container.

Fixes gh-25590
2021-03-17 15:19:21 -05:00
Andy Wilkinson
ae2ff7849b Revert "Fail fast when finalName is misconfigured"
This reverts commit 263b7c20e4ad4bdc9bbd5f0e68bcd1d706d8a29c.

See gh-25590
2021-03-17 11:11:24 +00:00
Scott Frederick
263b7c20e4 Fail fast when finalName is misconfigured
When the `finalName` parameter is incorrectly set in the Spring Boot
Maven plugin configuration instead of in the `build` configuration, the
repackaged and original archive files are not named as expected. Prior
to this commit, the image building goal would detect this error
condition and throw an exception late in the process of creating the
build container, leaving the container in an unstable state. This
commit changes the image building goal to detect this condition early,
before attempting to create the container.

Fixes gh-25590
2021-03-16 17:22:48 -05:00
dreis2211
4937547b8a Fix build deprecation warnings about duplicate jar entries
See gh-25116
2021-02-09 14:45:58 +01:00
Andy Wilkinson
67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
2021-02-02 13:03:21 +00:00
Phillip Webb
939b5dfc26 Add junit-platform-launcher dependency
Update `build.gradle` files to ensure that `junit-platform-launcher` is
a `testRuntimeOnly` dependency. This ensures that tests can be run from
Eclipse.

Closes gh-25074
2021-02-01 15:31:28 -08:00
Andy Wilkinson
5ad4d627fd Fix classpath index so entries match those expected by the launcher
This reverts commit ad164269e9aa7d0f39362d78d946a146dac5fdee and adds
some additional tests.

Fixes gh-24192
2021-01-08 15:32:19 +00:00
Phillip Webb
29300530c6 Polish 2020-12-15 19:44:40 -08:00
Phillip Webb
f84323fe3e Prevent duplicate jar entries from being written
Update the `AbstractJarWriter` so that it can directly build the layer
index as entries are written. Prior to this commit, a layer tracking
was handled by a decorator class which was broken because it didn't
override enough methods. Since `AbstractJarWriter` has quite a complex
API, it seems sensible to have it handle the layer index directly,
removing the need for a decorator entirely.

Fixes gh-23801
2020-10-22 20:55:09 -07:00
Phillip Webb
f7452b9383 Ensure LayoutFactory is not passed an empty file
Update `Repackager` to ensure that `getLayout` is called before we
backup the source file. This restores earlier behavior that some
custom `ModuleFactory` implementations were relying on.

Closes gh-22995
2020-08-18 16:45:44 -07:00
dreis2211
021d9b59cb Cleanup temporary files after Maven plugin execution
See gh-22112
2020-07-14 15:08:19 +01:00
Andy Wilkinson
0de466e06e Require dependency on s-b-dependencies to use its constraints
Previously, Spring Boot's modules published Gradle Module Metadata
(GMM) the declared a platform dependency on spring-boot-dependencies.
This provided versions for each module's own dependencies but also had
they unwanted side-effect of pulling in spring-boot-dependencies
constraints which would influence the version of other dependencies
declared in the same configuration. This was undesirable as users
should be able to opt in to this level of dependency management, either
by using the dependency management plugin or by using Gradle's built-in
support via a platform dependency on spring-boot-dependencies.

This commit reworks how Spring Boot's build uses
spring-boot-dependencies and spring-boot-parent to provide its own
dependency management. Configurations that aren't seen by consumers are
configured to extend a dependencyManagement configuration that has an
enforced platform dependency on spring-boot-parent. This enforces
spring-boot-parent's version constraints on Spring Boot's build without
making them visible to consumers. To ensure that the versions that
Spring Boot has been built against are visible to consumers, the
Maven publication that produces pom files and GMM for the published
modules is configured to use the resolved versions from the module's
runtime classpath.

Fixes gh-21911
2020-06-16 08:50:21 +01:00
Andy Wilkinson
c7a5b72565 Improve compatibility by replacing use of seq with a native for-loop
Closes gh-21068
2020-04-29 19:30:35 +01:00
Phillip Webb
ad1248e4ec Replace "folder" with "directory"
Consistently use the term "directory" instead of "folder"

Closes gh-21218
2020-04-28 19:20:24 -07:00
Johnny Lim
29717423a3 Remove this keyword on member method invocations
See gh-21007
2020-04-25 08:49:44 +02:00
Scott Frederick
fa186aa15b Preserve timestamps on loader directories
Prior to this commit, when the Maven plugin copied
spring-boot-loader.jar to a repackaged archive the timestamps of class
files were preserved but the timestamps of directories were not
preserved. This resulted in the directories having a current timestamp.

This commit copies the directory timestamps from spring-boot-loader.jar
to the repackaged archive and adds tests to verify the proper
behavior.

See gh-20927
2020-04-21 18:58:34 -05:00
dreis2211
d4575bc122 Fix unused parameters
See gh-20911
2020-04-10 14:06:42 +02:00
dreis2211
ae15a3d162 Polish LayersIndex
See gh-20874
2020-04-08 17:29:07 +02:00
Phillip Webb
729fc9dd6d Ensure streams are always closed
Update `AbstractJarWriter` to ensure that streams are always closed,
even if entries are not written.
2020-04-06 23:48:37 -07:00
Phillip Webb
1abbfbbfcd Attempt to fix failing Windows test 2020-04-06 23:48:28 -07:00
Phillip Webb
951a3e78f9 Test layer index can contain filenames with spaces
Add tests to ensure that the layer index can support filenames that
contain spaces.

Closes gh-20827
2020-04-06 19:18:22 -07:00
Phillip Webb
464c15e52c Ensure empty layers are written to the index file
Update the `LayersIndex` class to ensure that layers that do not contain
content are still written.

Closes gh-20858
2020-04-06 19:18:22 -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
Phillip Webb
65672a1150 Use a more compact layers.idx format
Update the `layers.idx` format so that it is more compact and can be
parsed by third-parties as YAML.

Closes gh-20860
2020-04-06 19:18:22 -07:00
Andy Wilkinson
34e602652c Polish new layered jar support 2020-04-03 10:47:57 +01: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
Phillip Webb
3f806aa513 Create a new layer for loader classes
Create a dedicated layer that is used to hold the launcher support
classes. The layer sits between `dependencies` and
`snapshot-dependencies` so that the layer is sensible for both
SNAPSHOT and RELEASE versions of Spring Boot

Closes gh-20529
2020-04-03 00:09:30 -07:00
Phillip Webb
7bc7d86ad4 Refine layer customization for Maven and Gradle
Simplify layer customization logic for both Maven and Gradle and
refactor some internals of the Gradle plugin.

Both Maven and Gradle now use a simpler customization format that
consists of `application`, `dependencies` and `layer order` sections.
The `application`, `dependencies` configurations support one or more
`into` blocks that are used to select content for a specific layer.

Closes gh-20526
2020-04-03 00:03:21 -07:00
dreis2211
674f1e77b5 Fix typos
See gh-20704
2020-03-28 08:42:59 +01: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
0717de723f Polish 2020-03-23 20:03:44 -07:00
Madhura Bhave
a06f4f21e3 Combine application and resources layers into a single layer
Closes gh-20562
2020-03-23 12:59:42 -07:00
Madhura Bhave
3e8ee2a296 Add missing package-info.json
Closes gh-20516
2020-03-16 16:11:02 -07:00
Madhura Bhave
84b2e8c308 Rename classes package to application
Closes gh-20526
2020-03-16 16:03:29 -07:00
Scott Frederick
f2dadf5a87 Add support for customizing layers in Gradle
This commit adds configuration to the Spring Boot Gradle plugin that
allows the names and contents of layers to be customized in the build
configuration.

Fixes gh-20296
2020-03-16 17:27:32 -05:00
Andy Wilkinson
c4a55a5fb4 Fail fast when attempting to repackage a reproducible war
Maven's war plugin does not support reproducible builds, resulting in
the entries in the war file not being written in a consistent order
from build to build.

Closes gh-20176
2020-03-16 20:29:37 +00:00
Andy Wilkinson
ca202ad59f Support Maven's outputTimestamp when repackaging jars and wars
Closes gh-20176
2020-03-16 17:19:52 +00:00
Madhura Bhave
e49e62df5c Add support for customizing layers in Maven
This commit adds an additional 'layers/configuration' property that can
be used to refer to a separate layers configuration file. This separate
file defines:

* The layers and their order of precedence,
* How libraries are handled using filters that match against the
coordinates of each library, and
* How classes are handled using filters that match against the location
of the entry

An XSD to validate the XML configuration file is available.

Closes gh-20295

Co-authored-by: Stephane Nicoll <snicoll@pivotal.io>
2020-03-12 14:50:08 +01:00
Stephane Nicoll
03bee83991 Update copyright date
See gh-20192
2020-02-16 17:20:48 +01:00
zhangt2333
e2d87a89d0 Polish
See gh-20192
2020-02-16 17:19:18 +01:00
Madhura Bhave
ec42dcd173 Fix typo 2020-02-10 15:22:13 -08:00
Phillip Webb
1eee83a07e Update copyright year of changed files 2020-01-30 17:09:49 -08:00
dreis2211
d8e2349e47 Use Supplier variants of Assert
See gh-19864
2020-01-28 15:04:11 +01:00
Phillip Webb
b5b4a02c61 Automatically add jarmode jars when packaging
Update the `Packager` to automatically add the layertools jarmode jar
when producing a layered jar.

Closes gh-19865
2020-01-22 23:14:47 -08:00