Commit Graph

1287 Commits

Author SHA1 Message Date
Scott Frederick 0ad7f76263 Preserve file permissions in images built by Gradle
This commit copies the file mode along with other attributes when
copying files from the source archive to the build container while
building an image using the Gradle plugin. This preserves file
permissions on any resources included in the source archive.

Fixes gh-25915
2021-04-08 12:56:41 -05:00
Andy Wilkinson b35d1ec6e8 Revert "Use test harness for image building integration tests"
This reverts commit da9d8d6055.

See gh-25838
2021-04-07 09:30:51 +01:00
Scott Frederick da9d8d6055 Use test harness for image building integration tests
This commit modifies the integration tests for the Maven and Gradle
image building goal and task to use a custom builder as a test harness
to verify that the plugins invoke the builder as expected.

Fixes gh-25838
2021-03-30 16:48:28 -05:00
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
Andy Wilkinson 5a086321c6 Polish "Document Failsafe configuration when not using starter parent"
See gh-25621
2021-03-30 18:16:21 +01:00
robert-smith-911 0d79fd3e01 Document Failsafe configuration when not using starter parent
See gh-25621
2021-03-30 18:02:12 +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 ec21202d54 Delete unpacked jars when the JVM exits
Update `JarFileArchive` so that any unpacked files are now deleted when
the JVM exits.

Closes gh-25773
2021-03-23 17:06:56 -07:00
Phillip Webb 05f61bccea Align unpack logic with Files.createTempDirectory
Update `JarFileArchive` to align the way that it creates temp files and
folders with the way that `Files.createTempDirectory` works.

Closes gh-25772
2021-03-23 17:06:56 -07:00
Phillip Webb b8873578ca Add missing @Deprecated annotations 2021-03-23 17:06:53 -07: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 0e0418546b Test spring-boot:build-image when repackage is also invoked
Closes gh-25714
2021-03-17 11:19:29 +00:00
Andy Wilkinson ae2ff7849b Revert "Fail fast when finalName is misconfigured"
This reverts commit 263b7c20e4.

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
Stephane Nicoll 6ebc69d704 Polish "Include properties in source merge algorithm"
See gh-25507
2021-03-05 15:47:09 +01:00
Bertrand Renuart cf4bc6e9e0 Include properties in source merge algorithm
This commit improves SimpleConfigurationMetadataRepository to include
properties that are contributed to an existing configuration metadata
source.

See gh-25507
2021-03-05 15:47:09 +01:00
Andy Wilkinson c6ca7a53ab Polish "Prevent extracting zip entries outside of destination path"
See gh-25505
2021-03-05 10:13:32 +00:00
trungPa 2993e68715 Prevent extracting zip entries outside of destination path
See gh-25505
2021-03-05 10:12:06 +00:00
Stephane Nicoll 8e67ae7113 Fix fallback fork value for spring-boot:stop
This commit harmonizes the fallback value that spring-boot:stop goal
should use if no information is available in the current context.

Closes gh-25472
2021-03-03 15:15:04 +01:00
Stefan Wolf 86ca32e694 Enable stricter validation for Gradle plugin
See gh-25409
2021-02-25 17:28:51 +00:00
dreis2211 101d88a840 Update Testcontainers image versions
See gh-25412
2021-02-25 14:27:41 +00:00
Stephane Nicoll 77daae1480 Update copyright year of changed file
See gh-25382
2021-02-22 10:41:49 +01:00
Mustafa Ulu abc90db32f Fix wording error in build-info goal description
See gh-25382
2021-02-22 10:26:53 +01:00
Andy Wilkinson a2adb877ee Polish "Encourage use of maven-publish plugin in Gradle docs"
See gh-25299
2021-02-16 11:22:47 +00:00
Robert Smith c0a5245a3e Encourage use of maven-publish plugin in Gradle docs
See gh-25299
2021-02-16 11:19:27 +00: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 630d216430 Update copyright year of changed files 2021-02-01 22:10:24 -08:00
Phillip Webb c404a50a2e Allow test to use snapshot/milestone repo
Update `spring-boot-maven-plugin` `settings.xml` so that milestone and
snapshot dependencies can be resolved.

See gh-23936
2021-02-01 19:45:11 -08:00
Phillip Webb faaa5e4186 Fix BOM attached sourceSet
See gh-23936
2021-02-01 16:51:53 -08:00
Phillip Webb 40c1748e3c Remove hardcoded versions from MavenBuild
Use the dependencies BOM to ensure versions used in the `MavenBuild`
test class are always aligned.

Closes gh-23936
2021-02-01 16:20:55 -08: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
jongmin92 23ecb86089 Document missing code to run Gradle bootRun task
See gh-25012
2021-01-28 18:56:21 -08:00
Phillip Webb 464b302655 Set withTestKitDir per Gradle version
Attempt to fix cache locking issues by setting a unique `withTestKitDir`
directory for each tested Gradle version.

Closes gh-24993
2021-01-25 21:35:25 -08:00
Andy Wilkinson 46d908f632 Upgrade to Gradle 6.8.1
Closes gh-24737
2021-01-22 14:20:57 +00:00
Phillip Webb 9da0bd8523 Update copyright year of changed files 2021-01-12 12:02:57 -08:00
Andy Wilkinson 997505005b Handle files larger than Integer.MAX_VALUE bytes in bootJar and bootWar
Fixes gh-24618
2021-01-12 13:11:46 +00:00
Andy Wilkinson 7625a979db Configure bootRun to use project's Java toolchain by default
Previously, unlike the application plugin's run task, our bootRun task
ignored the project's Java toolchain. This meant that the application
was run on a JVM with the same Java version as the one being used by
Gradle itself. This could result in a failure if the application
required a more modern JVM.

This commit updates the plugin to configure the bootRun task's
JavaLauncher convention to be one derived from the project's Java
toolchain. Toolchain support was introduced in Gradle 6.7 so this is
only done when using Gradle 6.7 and later.

Fixes gh-24517
2021-01-11 11:21:53 +00:00
Andy Wilkinson 064de4e073 Check configured JavaLauncher when determining version of the JVM
Previously, bootRun assumed that the Java version of the JVM that would
run the application would be the same as the Java version of the JVM
that is running the build. This assumption does not hold true when
Gradle's toolchain support is used to configure tasks that fork a new
JVM to use a version other than that being used by Gradle itself.

This commit updates the BootRun task to query the JavaLauncher property
when determining the version of Java on which the application will be
run. Toolchain support and the JavaLauncher property are new in Gradle
6.7. To support earlier versions of Gradle, NoSuchMethodError is caught
we continue as if no JavaLauncher has been configured and use the local
JVM's Java version.

Fixes gh-24512
2021-01-11 10:36:16 +00:00
Andy Wilkinson 5ad4d627fd Fix classpath index so entries match those expected by the launcher
This reverts commit ad164269e9 and adds
some additional tests.

Fixes gh-24192
2021-01-08 15:32:19 +00:00
Scott Frederick a302238e21 Remove layout parameters from build-image Maven goal
This commit removes the `layout` and `layoutFactory` parameters
from the `build-image` goal in the Maven plugin while retaining
them for the `repackage` goal. The `build-image` goal currently
only supports jar archives, so allowing other layout types to be
configured for the goal could cause confusion.

Fixes gh-24105
2021-01-07 15:59:02 -06:00
Stephane Nicoll 306b964ce3 Fix multi-release JAR test on JDK 16
See gh-24453
2020-12-21 09:59:01 +01:00
Phillip Webb c4e41305d5 Prevent Tomcat URL "reflective access" warnings
Update the jar `Handler` class to support a non-reflective fallback
mechanism when possible. The updated code attempts to capture a regular
jar URL before our handler is installed. It can then use that URL as
context when creating the a fallback URL. The JDK jar `Handler` will
be copied from the context URL to the fallback URL.

Without this commit, resolving new Tomcat URLs of the form
`jar:war:file:...` would result in an ugly "Illegal reflective access"
warning.

Fixes gh-18631
2020-12-17 20:43:41 -08:00
Scott Frederick e4d124dc45 Improve error message with Maven build-image and war packaging
Fixes gh-24522
2020-12-16 15:58:53 -06:00
Scott Frederick 0e5df2296e Fail with Gradle bootBuildImage and war packaging
Prior to this commit, running the bootBuildImage Gradle task on a
project configured for war packaging would result in a jar file being
built and used in the image instead of the war file. With this commit
an error will be thrown from the plugin in this case.

Fixes gh-24521
2020-12-16 13:23:43 -06:00
Phillip Webb 29300530c6 Polish 2020-12-15 19:44:40 -08:00