Commit Graph

289 Commits (a889c539abdb8667c2079479b08b28a0a3c586ff)

Author SHA1 Message Date
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>
5 years ago
Stephane Nicoll 03bee83991 Update copyright date
See gh-20192
5 years ago
zhangt2333 e2d87a89d0 Polish
See gh-20192
5 years ago
Madhura Bhave ec42dcd173 Fix typo 5 years ago
Phillip Webb 1eee83a07e Update copyright year of changed files 5 years ago
dreis2211 d8e2349e47 Use Supplier variants of Assert
See gh-19864
5 years ago
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
5 years ago
Phillip Webb 57db621b70 Polish 5 years ago
Phillip Webb e0013454b5 Use parentheses when declaring dependencies
Update all dependencies declarations to use the form `scope(reference)`
rather than `scope reference`.

Prior to this commit we declared dependencies without parentheses unless
we were forced to add them due to an `exclude`.
5 years ago
Phillip Webb 0209cd3e4c Polish quote form used in Gradle scripts
Replace Gradle single quote strings with the double quote form
whenever possible. The change helps to being consistency to the
dependencies section where mostly single quotes were used, but
occasionally double quotes were required due to `${}` references.
5 years ago
Phillip Webb d5a70688cb Reserve layer names for future use
Update layered jar support so that the name `ext` and any name
starting `springboot` are reserved.

See gh-19767
5 years ago
Phillip Webb 7d8f8d47c8 Fix packager code to generate layer index file
Update `Packager` to create the layer index file when repackaging.

Closes gh-19767
5 years ago
Andy Wilkinson 1e72fa202c Rework loader-tools resource generation to work with Buildship
Previously, the generated resources were added as an output to the
main source set. This worked on the command line, but resulted in
the META-INF folder that contains the loader jar not being on the
classpath of downstream projects in Eclipse.

This commit changes loader-tools to add the generated resources
as a srcDir to the main source set. This results in it appearing on
the classpath of other projects in Eclipse that depend on loader-tools
such as the Gradle plugin, thereby allowing its tests to be run in
the IDE as well as on the command line.

Fixes gh-19841
5 years ago
Phillip Webb 16e6bc89ed Create a new ImagePackager tools class
Pull functionality from `Repackager` into a new `Packager` base class
and develop a variant for Docker image creation. The new `ImagePackager`
class provides a general purpose way to construct jar entries without
being tied to an actual file. This will allow us to link it to a
buildpack and provide application content directly.

Closes gh-19834
5 years ago
Andy Wilkinson 408f17f821 Close FileInputStreams in RepackagerTests 5 years ago
Andy Wilkinson 724597d45f Use a centrally managed version for commons-compress 5 years ago
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>
5 years ago
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>
5 years ago
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
5 years ago
Andy Wilkinson 714a187d8f Rework dep mgmt again to avoid consumers picking up strict constraints
This paves the way for publishing Gradle module metadata once the
problem caused by snapshot versions and our two-step publication
process has been addressed.

See gh-19609
5 years ago
Andy Wilkinson aefe52e4d0 Revert "Rework dep management to avoid consumers picking up strict constraints"
This reverts commit b34a311d02 as,
having disabled the publishing of Gradle's module metadata (4f75ab5),
the changes are no longer needed.

See gh-19609
5 years ago
Phillip Webb f57281340c Merge branch '2.2.x' 5 years ago
Phillip Webb 3cfbfebbb1 Merge branch '2.1.x' into 2.2.x 5 years ago
Phillip Webb 9bd49562fe Update copyright year of changed files 5 years ago
Andy Wilkinson b34a311d02 Rework dep management to avoid consumers picking up strict constraints
Previously, enforcedPlatform dependencies were using to pull in the
constraints defined in spring-boot-dependencies and
spring-boot-parent and applied them strictly so that the constrained
version had to be used. This worked as intended in Spring Boot's own
build but incorrectly enforced those same strict version requirements
on external consumers of Spring Boot's modules.

This commit reworks how Spring Boot defines its internal dependency
management so that platform dependencies are exposed to external
consumers while enforced platform dependencies are using internally.

See gh-19609
5 years ago
Andy Wilkinson ce99db1902 Port the build to Gradle
Closes gh-19609
Closes gh-19608
5 years ago
Andy Wilkinson fc3f6a930d Merge branch '2.1.x' into 2.2.x
Closes gh-18940
5 years ago
Andy Wilkinson 5765cfe010 Allow 5 seconds for child to handle SIGINT before destroying it
Previously, when RunProcess handled a SIGINT it would immediately
attempt to destroy the process that it had run. This created a race
condition between the SIGINT being handled by the child process
and RunProcess destroying the child. The exact behavior of destroy
is implementation dependent and it may result in forcible termination
of the process where shutdown hooks are not called. This is what
happens on Windows. The exit code in such a case is 1 which prevents
anything from waiting for the process to complete from detecting
that it ended as a result of a SIGINT, leaving it with no choice but
to report an error. This is what happens with mvn spring-boot:run
with a forked process on Windows and results in the build failing.

This commit updates RunProcess to allow the child process to handle
the SIGINT itself, waiting for up to five seconds for that to happen
before the process is then destroyed. Given this time, the child
process exits with 130 which RunMojo already handles correctly as
indicating that the process died due to SIGINT and the build completes
with success as a result.

Fixes gh-18936
5 years ago
Andy Wilkinson 46c30d6bb0 Merge branch '2.1.x'
Closes gh-18476
5 years ago
Andy Wilkinson 3d4157ad6d Correct SCM URLs in published poms
Previously, Maven's default behaviour was relied up which resulted
in the artifact ID being appended to each URL as it was inherited.
This behaviour can only be disabled in Maven 3.6 and later, a version
that we cannot use due to an incompatibility with the Flatten Plugin.

This commit works around Maven's default behaviour by defining
properties for the SCM URL, connection, and developer connection and
then explicitly defining the settings in each pom using these
properties. The explicit definition of the properties in each pom
prevents them being inherited from the parent, thereby disabling the
unwanted appending of the artifact ID to the URL.

Fixes gh-18328
5 years ago
Stephane Nicoll e0d6d90683 Merge branch '2.1.x'
Closes gh-18447
5 years ago
dreis2211 417bfc4c87 Fix comment position in ZipHeaderPeekInputStreamTests
See gh-18445
5 years ago
Andy Wilkinson 79b5fd9d73 Polish "Allow the user that runs the app to be specified via an env var"
See gh-16973
5 years ago
Wagner Macedo b57f35893c Allow the user that runs the app to be specified via an env var
See gh-16973
5 years ago
dreis2211 d4affd7f85 Use hasSize() assertion in favor of length checks
See gh-17874
5 years ago
Phillip Webb 8bc780762a Merge branch '2.1.x' 5 years ago
Phillip Webb fb1dd8fe93 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb 913e831f4e Merge '1.5.x' into 2.0.x 5 years ago
Phillip Webb 01933f9b06 Merge previously split strings
Merge some string lines that were previously split because of the
90 chars wide formatting.
5 years ago
Phillip Webb a66c4d3096 Unify method visibility of private classes
Apply checkstyle rule to ensure that private and package private
classes do not have unnecessary public methods. Test classes have
also been unified as much as possible to use default scoped
inner-classes.

Closes gh-7316
5 years ago
Phillip Webb 605599138e Merge branch '2.1.x' 5 years ago
Phillip Webb 92bff3c328 Merge branch '2.0.x' into 2.1.x 5 years ago
Phillip Webb cfeb0239b7 Merge branch '1.5.x' into 2.0.x 5 years ago
Stephane Nicoll e560b7f6ba Remove public modifier on JUnit5 lifecycle methods
See gh-17292
5 years ago
Andy Wilkinson cffc870fd6 Fix test failures on Windows
Since the move to JUnit 5, a number of tests were failing on Windows.
The majority were failing due to open file handles preventing the
clean up of the tests' temporary directory. This commit addresses
these failures by updating the tests to close JarFiles, InputStreams,
OutputStreams etc.

A change has also been made to CachingOperationInvokerTests to make
a flakey test more robust. Due to System.currentTimeMillis() being
less precise on Windows than it is on *nix platforms, the test could
fail as it would not sleep for long enough for the TTL period to have
expired.
6 years ago
Andy Wilkinson 405b4ad441 Merge branch '2.1.x'
Closes gh-17118
6 years ago
Andy Wilkinson 2833f60344 Avoid leaving streams open when writing libraries
Fixes gh-17115
6 years ago
Andy Wilkinson b18fffaf14 Move tests to JUnit 5 wherever possible 6 years ago
Andy Wilkinson aef92b9295 Merge branch '2.1.x'
Closes gh-17079
6 years ago
Andy Wilkinson 24925c3dae Merge branch '2.0.x' into 2.1.x
Closes gh-17078
6 years ago
Andy Wilkinson c6c139d980 Merge branch '1.5.x' into 2.0.x 6 years ago
Phillip Webb d306b31ce9 Merge branch '2.1.x' 6 years ago
Phillip Webb ccfbd03482 Merge branch '2.0.x' into 2.1.x 6 years ago
Phillip Webb b442d3b906 Merge branch '1.5.x' into 2.0.x 6 years ago
Andy Wilkinson c80218064f Use sorted properties to make build info output repeatable
Closes gh-14494
6 years ago
Andy Wilkinson 36c1c051b8 Merge branch '2.1.x' 6 years ago
Andy Wilkinson e23f72c8b0 Merge branch '2.0.x' into 2.1.x 6 years ago
Andy Wilkinson 9fbd38ab3c Merge branch '1.5.x' into 2.0.x 6 years ago
Andy Wilkinson b828b398b5 Merge branch '2.1.x' 6 years ago
Andy Wilkinson a36aa67b52 Merge branch '2.0.x' into 2.1.x 6 years ago
Spring Operator 3e2b6ac8ed Update build and setup configuration to use HTTPS
See gh-16246
6 years ago
Andy Wilkinson 43c9a789ac Merge branch '2.1.x' 6 years ago
Robert Thornton cb6362df82 Use kotlin_module not kotlin-module to identify Kotlin module metadata
See gh-16004
6 years ago
Andy Wilkinson 0adea5a905 Merge branch '2.1.x' 6 years ago
Andy Wilkinson 948bafa4d8 Repackage kotlin-module metadata beneath BOOT-INF/classes
Closes gh-15890
6 years ago
Andy Wilkinson 342bced125 Merge branch '2.1.x' 6 years ago
Andy Wilkinson 2650a07dc9 Leave module-info.class in root of archive when repackaging
Closes gh-15810
6 years ago
igor-suhorukov dfb3cd51bc Simplify code by using for-each loop
See gh-15563
6 years ago
Andy Wilkinson 61d04db0d7 Minimize and centralize assumptions about build output
Closes gh-15471
6 years ago
Stephane Nicoll bf88a7e466 Be more lenient when repackage is invoked several times
This commit makes the repackager more lenient when it is invoked several
times in the same lifecycle.

Closes gh-15034
6 years ago
Madhura Bhave f0004c4ade Merge branch '2.0.x' 6 years ago
dreis2211 5c0d7f4ac0 Avoid creation of unnecessary collections
Closes gh-14916
6 years ago
Andy Wilkinson 4a222cb4e5 Polish "Log a warning when using fallback for pid and log locations"
Closes gh-14519
6 years ago
Andreas Gebhardt 3f894cbeeb Log a warning when using fallback for pid and log locations
See gh-14519
6 years ago
Phillip Webb d76bba5e6f Migrate from ExpectedException rule to AssertJ
Replace ExpectedException JUnit rules with AssertJ exception
assertions.

Closes gh-14336
6 years ago
Andy Wilkinson 1332fcb0ad Polish "Issue a warning from launch script when app will run as root"
Closes gh-10275
6 years ago
Oliver B. Fischer 94ebd33747 Issue a warning from launch script when app will run as root
See gh-10275
6 years ago
Phillip Webb 9d1b3a2b49 Merge branch '2.0.x' 6 years ago
Phillip Webb cafff43022 Update copyright header of changed files 6 years ago
Stephane Nicoll c00fc6449b Merge branch '2.0.x' 6 years ago
dreis2211 59d911d6e0 Remove @UsesUnsafeJava annotations
Closes gh-14072
6 years ago
Phillip Webb 1b91c0ceb7 Merge branch '2.0.x' 6 years ago
Phillip Webb 0ec22c8bf9 Polish copyright date on changed files 6 years ago
Phillip Webb 80da9cf5eb Merge branch '2.0.x' 6 years ago
Phillip Webb aeb885192e Polish ternary expressions 6 years ago
Phillip Webb a6c9c92f2e Merge branch '2.0.x' 6 years ago
Phillip Webb 63b609827e Fix checkstyle method order issues
Fix checkstyle issues with method ordering following the
spring-javaformat upgrade.

See gh-13932
6 years ago
Phillip Webb e6a68b39a3 Fix checkstyle javadoc issues
Fix checkstyle issues in javadoc following the spring-javaformat
upgrade.

See gh-13932
6 years ago
Phillip Webb 7fc455654a Fix checkstyle ternary issues
Fix checkstyle issues with ternary expressions following the
spring-javaformat upgrade.

See gh-13932
6 years ago
Andy Wilkinson 918191664a Merge branch '2.0.x' 6 years ago
Andy Wilkinson 9eb5c9bd18 Merge branch '1.5.x' into 2.0.x 6 years ago
Andy Wilkinson c12f8298e6 Merge branch '2.0.x' 7 years ago
Andy Wilkinson 814e90805e Merge branch '1.5.x' into 2.0.x 7 years ago
Stephane Nicoll b17c58b114 Merge branch '2.0.x' 7 years ago
Johnny Lim 3dd2f5bb05 Polish
See gh-13148
7 years ago
Stephane Nicoll b0433d66c1 Merge branch '2.0.x' 7 years ago
dreis2211 e6a23fa3ff Remove unnecessary semicolons
Closes gh-13144
7 years ago
Andy Wilkinson 07251a09d1 Merge branch '2.0.x' 7 years ago
Andy Wilkinson d9d7499ae6 Merge branch '1.5.x' into 2.0.x 7 years ago
Stephane Nicoll 00a43d8f4d Merge branch '2.0.x' 7 years ago
Johnny Lim 75e591e76e Polish
Closes gh-13130
7 years ago
Phillip Webb 8c0c0ee55a Merge branch '2.0.x' 7 years ago
Phillip Webb e125085993 Merge branch '1.5.x' into 2.0.x 7 years ago
Stephane Nicoll 40b7e02793 Polish "Add support for environment variables"
Closes gh-12800
7 years ago
Dmytro Nosan 95f7e3ca37 Add support for environment variables
See gh-12800
7 years ago
Phillip Webb 685babc829 Polish "Use lambdas for map entry iteration where possible"
Closes gh-12626
7 years ago
igor-suhorukov 69bc19e0ca Use lambdas for map entry iteration where possible
See gh-12626
7 years ago
Andy Wilkinson 6d16c5ff6e Omit libraries with null destination when repackaging
Closes gh-12437
7 years ago
dreis2211 3adced9962 Remove workaround for JDK-8023130 in RunProcess
With JDK 8 being the baseline and JDK 7 not being supported anymore we
can get rid of the workaround for a JDK 7 bug in
ProcessBuilder.inheritIO on Windows machines.

Closes gh-12337
7 years ago
Andy Wilkinson fdb9a1ea8f Consider time in BuildInfo up-to-date checks and allow it to be set
Closes gh-12111
Closes gh-12266
7 years ago
Phillip Webb 29c3be3590 Polish 7 years ago
Stephane Nicoll 306c79f0de Merge branch '1.5.x' 7 years ago
Johnny Lim d441a8a89a Polish
Closes gh-12205
7 years ago
Phillip Webb 4b9c3c137e Polish Collection.toArray
Consistently use `StringUtils.toStringArray`, `ClassUtils.toClassArray`
or zero length when converting collections to arrays.

Fixes gh-12160
7 years ago
Johnny Lim 88b184ca23 Polish 7 years ago
Andy Wilkinson e1ab62668f Merge branch '1.5.x' 7 years ago
Andy Wilkinson 1d2b85b2b8 Ensure that TestJarFile uses insertion order for jar's entries
Previously, the order of the entries in a TestJarFile was determined
by the underlying file system rather than by the order in which
they were added. This could lead to unpredicatable ordering and
failures in tests that verify archive entry ordering.

This commit updates TestJarFile to add entries to the archive in
insertion order.

See gh-11695
See gh-11696
7 years ago
Andy Wilkinson b2dad7f1c4 Rework entry ordering of repackaged archives
Previously, the Repackager would write entries in the following
order:

- Libraries that require unpacking
- Existing entries
    - Application classes
    - WEB-INF/lib jars in a war
- Libraries that do not require unpacking
- Loader classes

Libraries that require unpacking were written before existing entries
so that, when repackaging a war, an entry in WEB-INF/lib would not
get in first and prevent a library with same location from being
unpacked. However, this had the unwanted side-effect of changing
the classpath order when an entry requires unpacking.

This commit reworks the handling of existing entries and libraries
that require unpacking so that existing entries can be written first
while also marking any that match a library that requires unpacking
as requiring unpacking.

Additionally, loader classes are now written first. They are the
first classes in the jar that will be used so it seems to make sense
for them to appear first. This aligns Maven-based repackaging
with the Gradle plugin's behaviour and with the structure documented
in the reference documentation's "The Executable Jar Format" appendix.

The net result of the changes described above is that entries are
now written in the following order:

- Loader classes
- Existing entries
    - Application classes
    - WEB-INF/lib jars in a war marked for unpacking if needed
- Libraries

Closes gh-11695
Closes gh-11696
7 years ago
Phillip Webb 886b39293c Merge branch '1.5.x' 7 years ago
andrey.onufreyko b19dcb13e2 Replace string arguments with char
Optimize method calls by replacing single character String arguments
with char.

Closes gh-11680
7 years ago
Andy Wilkinson 54c0cf513b Polish 7 years ago
Stephane Nicoll d43346d6c2 Polish "Fix potential resource leaks"
Closes gh-11624
7 years ago
igor-suhorukov 5a4238acfc Fix potential resource leaks
See gh-11624
7 years ago
Madhura Bhave 8102dc78cb Remove redundant throws declarations 7 years ago
Johnny Lim 8f7ab95e0e Use BufferedReader.lines()
Closes gh-11436
7 years ago
Phillip Webb 5ca608330c Merge branch '1.5.x' 7 years ago
Stephane Nicoll 23218add90 Polish 7 years ago
Johnny Lim 6d54072e04 Remove "final" keywords
Closes gh-11294
7 years ago
Johnny Lim 44299bb980 Polish
Closes gh-11206
7 years ago
Johnny Lim bd0dcfb172 Utilize StandardCharsets
Closes gh-10972
7 years ago
Johnny Lim c05a299520 Polish
Closes gh-10921
7 years ago
Johnny Lim 84d137d41d Restore execution permission on launch.script
Restore the execute permission that was accidentally removed in
commit 5ee28a08e1.

Closes gh-10801
7 years ago
Stephane Nicoll 4dcc354f86 Merge branch '1.5.x' 7 years ago
Stephane Nicoll a688613fb4 Merge branch '1.5.x' 7 years ago
Stephane Nicoll dd90f071c6 Bump ASM version to be Java 8+ compatible
Closes gh-10647
7 years ago
dreis2211 3b71393e0a Use Assert.state() with Supplier where possible
See gh-10658
7 years ago
Phillip Webb 748e0779b6 Update copyright year for changed files 7 years ago
Phillip Webb b87f9c11f1 Fix POMs for the updated build/release process
Fix POMs following project relocations and apply CI friendly Maven
conventions.

See gh-9316
7 years ago
Phillip Webb 0ba4830b4f Relocate projects to spring-boot-project
Move projects to better reflect the way that Spring Boot is released.

The following projects are under `spring-boot-project`:

  - `spring-boot`
  - `spring-boot-autoconfigure`
  - `spring-boot-tools`
  - `spring-boot-starters`
  - `spring-boot-actuator`
  - `spring-boot-actuator-autoconfigure`
  - `spring-boot-test`
  - `spring-boot-test-autoconfigure`
  - `spring-boot-devtools`
  - `spring-boot-cli`
  - `spring-boot-docs`

See gh-9316
7 years ago