Commit Graph

1311 Commits

Author SHA1 Message Date
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
Phillip Webb 11f285bde5 Merge branch '2.2.x' into 2.3.x
Closes gh-24403
2020-12-08 12:12:51 -08:00
Phillip Webb 5f351a6983 Merge branch '2.2.x' into 2.3.x
Closes gh-24338
2020-12-04 18:21:57 -08:00
Phillip Webb 837fc83527 Fix checkstyle header violations
See gh-24337
2020-12-04 18:05:53 -08:00
Scott Frederick da2276e7d4 Use stable builder and run images in integration tests
Fixes gh-24183
2020-11-17 13:54:10 -06:00
Andy Wilkinson e6ab20b029 Merge branch '2.2.x' into 2.3.x
Closes gh-24111
2020-11-10 17:37:41 +00:00
Andy Wilkinson 31042bfc49 Test inclusion of system scope dependencies in repackaged war
Closes gh-22503
2020-11-10 17:35:04 +00:00
Stephane Nicoll 9e901b6e07 Upgrade to Testcontainers 1.15.0
Closes gh-24103
2020-11-10 16:24:16 +01:00
Stephane Nicoll 23ad2b4156 Rationalize Testcontainers image versions
This commit rationalizes the Docker image names used in integration
tests.

Closes gh-24107
2020-11-10 16:04:27 +01:00
Stephane Nicoll 339c8d0a26 Revert "Upgrade to Testcontainers 1.15.0" 2020-11-10 09:47:46 +01:00
Stephane Nicoll 5123eb0c74 Fix deprecation in Testcontainers 1.15.0
See gh-24103
2020-11-10 09:39:18 +01:00
Stephane Nicoll c1a1b5fe71 Upgrade to Testcontainers 1.15.0
Closes gh-24103
2020-11-10 08:46:15 +01:00
Stephane Nicoll 6aca0275ad Polish 2020-11-09 14:40:44 +01:00
Stephane Nicoll 4a8646bd09 Merge branch '2.2.x' into 2.3.x
Closes gh-24058
2020-11-05 16:32:52 +01:00
Stephane Nicoll 59ea7c11f6 Use most specific getter when generating metadata
This commit makes sure to use the most specific getter if more than
one candidate exists.

Closes gh-24002
2020-11-05 16:01:28 +01:00
Andy Wilkinson f3d4b3e5ac Allow entries to be streamed from JarURLConnections' jar file
Fixes gh-23821
2020-11-03 17:59:38 +00:00
Phillip Webb b0c2687aa9 Update copyright year of changed files 2020-10-29 09:07:42 -07:00
Andy Wilkinson 70d9602b3f Merge branch '2.2.x' into 2.3.x
Closes gh-23969
2020-10-29 15:31:12 +00:00
Andy Wilkinson e7eb7739dc Use overriding rather than overridden getter methods in config prop AP
Fixes gh-23966
2020-10-29 15:30:46 +00:00
Phillip Webb b86dcbec72 Merge branch '2.2.x' into 2.3.x
Closes gh-23959
2020-10-28 21:18:17 -07:00
Phillip Webb cf09451ffb Retain inner-class data on incremental compile
Ensure that metadata sourced from inner-types is not deleted when
performing an incremental compile. Prior to this commit, the source
type was searched using the `Outer$Inner` format. This is not supported
`Elements.getTypeElement` so we now convert the names to `Outer.Inner`.

Closes gh-10886
2020-10-28 21:13:08 -07:00
Scott Frederick d5b2836ec9 Provide content-length header to Docker API calls
Docker daemon authorization plugins reject POST or PUT requests that have a
content type `application/json` header but no content length header. This
commit ensures that a content length header is provided in these cases.

Fixes gh-22840
2020-10-28 15:15:32 -05:00
Phillip Webb d79c23ef89 Upgrade MavenBuild versions
Align versions with those in the main build.

Closes gh-23937
2020-10-28 12:37:30 -07:00
Stephane Nicoll 0424689aee Merge branch '2.2.x' into 2.3.x
Closes gh-23930
2020-10-28 16:18:00 +01:00
Stephane Nicoll 93e36a97ab Remove version elements from Maven plugin documentation
This commit removes `<version>` from the Maven Plugin documentation
where it makes sense so that versions aren't hardcoded unnecessarily.

Rather, a plugin or dependency management should be in place so those
are not needed.

Closes gh-23909
2020-10-28 13:39:03 +01:00
Stephane Nicoll a3818d690e Fix custom layout example so that tokens are replaced 2020-10-28 13:37:59 +01: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
Andy Wilkinson 633027b1cd Upgrade to Gradle 6.7
Closes gh-23754
2020-10-19 17:52:01 +01:00
Andy Wilkinson 11b5e86ffd Deprecate BootJar#getConfigurations
Fixes gh-23527
2020-10-17 07:54:38 +01:00
Scott Frederick 9c672deb2d Add javadoc links in Maven plugin parameter docs
This commit modifies the documentation generated for the
Maven plugin to include links to javadoc when Spring
Boot types are mentioned. Some javadoc was also polished
to improve the generated docs.

Fixes gh-21555
2020-10-16 17:45:46 -05:00
Stephane Nicoll 6beb0c939f Document how to override plugin configuration on the command line
Closes gh-21536
2020-10-16 10:57:30 +02:00
Stephane Nicoll b210d0680a Polish 2020-10-16 10:34:58 +02:00
Scott Frederick de685bdca4 Document buildpack configuration of JVM options
Fixes gh-21582
2020-10-09 13:21:37 -05:00
Scott Frederick 49b0707f1a Clarify image builder configuration documentation
This commit qualifies examples of configuring the CNB builder to clarify
that the examples apply to use of the default Paketo builder, and adds links
to the official Paketo docs for more details.

Fixes gh-19967
2020-10-08 17:02:17 -05:00
Andy Wilkinson 543763462c Update tests to look for snippets in correct location
See gh-23598
2020-10-06 15:57:25 +01:00
Andy Wilkinson 7eb92cc71a More Gradle snippets to correct location
See gh-23598
2020-10-06 14:44:26 +01:00
Andy Wilkinson 2d3291fb83 Merge branch '2.2.x' into 2.3.x
Closes gh-23598
2020-10-06 14:35:49 +01:00
Andy Wilkinson 7ac14203ab Expand Gradle plugin's docs on setting bootRun's system properties
Closes gh-23578
2020-10-06 14:35:30 +01:00
Andy Wilkinson bd4934b0fd Fix matching of SNAPSHOT artifacts when customizing layers
Previously the artifact's version was used. In an artifact's version,
SNAPSHOT is replaced with the timestamped version number of a specific
snapshot. As a result, it no longer matches the *:*:*SNAPSHOT pattern.

This commit replaces switches to using the artifact's base version.
This preserves the SNAPSHOT in the version number. For non-snapshot
artifacts, the version and base version are identical.

Fixes gh-23533
2020-09-30 14:48:04 +01:00
Andy Wilkinson 9bd040cb0f Merge branch '2.2.x' into 2.3.x
Closes gh-23500
2020-09-26 09:16:46 +01:00
Andy Wilkinson e74f777971 Remove use of spring-core's Assert from PropertiesLauncher
Fixes gh-23474
2020-09-26 09:11:05 +01:00
Stephane Nicoll 37ded9f6d3 Merge branch '2.2.x' into 2.3.x
Closes gh-23446
2020-09-22 10:10:24 +02:00
dreis2211 fba1fb23e4 Fix multi-release JAR test on JDK 15
Backport of 54f93e9

See gh-23445
2020-09-22 10:09:18 +02:00
Phillip Webb 3fca8c6b4e Merge branch '2.2.x' into 2.3.x
Closes gh-23441
2020-09-21 22:27:45 -07:00
Phillip Webb 4945806d84 Make `StringSequence.isEmpty()` public
Make `StringSequence.isEmpty()` public for compatibility with JDK 15.

Closes gh-23440
2020-09-21 22:26:20 -07:00
Andy Wilkinson 8667e9ded8 Merge branch '2.2.x' into 2.3.x
Closes gh-23426
2020-09-21 12:16:14 +01:00
Andy Wilkinson 581190d7a0 Test the Gradle plugin against 6.7-rc-1
Closes gh-23425
2020-09-21 12:14:35 +01:00
Andy Wilkinson d06af28cd8 Merge branch '2.2.x' into 2.3.x
Closes gh-23422
2020-09-21 10:47:06 +01:00
Andy Wilkinson 360e29af48 Polish "Add note about Kotlin main class name"
See gh-23418
2020-09-21 10:40:29 +01:00
Sebastiaan Fernandez 0bde5fda9b Add note about Kotlin main class name
See gh-23418
2020-09-21 10:36:16 +01:00
Andy Wilkinson 3861ef13fb Merge branch '2.2.x' into 2.3.x
Closes gh-23406
2020-09-18 09:09:41 +01:00
Andy Wilkinson 5ec673ff2a Add anchors to section headers in Gradle plugin docs
Fixes gh-23402
2020-09-18 09:06:54 +01:00
Phillip Webb 5c1055dc22 Merge branch '2.2.x' into 2.3.x 2020-09-15 08:48:25 -07:00
Phillip Webb 195def0ec3 Merge branch '2.1.x' into 2.2.x 2020-09-15 08:48:00 -07:00
Phillip Webb e0030094e2 Fix missing jar entry certificates
Ensure that the source jar entry is closed before reading
certificates and code signers from the entry.

gh-19041
2020-09-15 08:42:58 -07:00
Phillip Webb a249a1a3d1 Merge branch '2.2.x' into 2.3.x 2020-09-14 13:52:22 -07:00
Phillip Webb b8e6b2ef94 Merge branch '2.1.x' into 2.2.x 2020-09-14 13:51:24 -07:00
Phillip Webb 4138e59c33 Fix potential JarFileEntries ClassCastException
Update `JarFileEntries` so that the interface is obtained rather than
the concrete implementation. This allows `JarEntry` values to be used
without causing a ClassCastException.

Closes gh-19041
2020-09-14 13:48:59 -07:00
Phillip Webb 45275e6586 Merge branch '2.2.x' into 2.3.x
Closes gh-23264
2020-09-13 22:49:21 -07:00
Phillip Webb a20fdf8e6a Merge branch '2.1.x' into 2.2.x
Closes gh-23263
2020-09-13 22:45:39 -07:00
Phillip Webb 895ff9c72d Merge pull request #19041 from mathieufortin01
* pr/19041:
  Polish 'Fix signed jar performance issues'
  Fix signed jar performance issues
  Ignore Visual Studio Code Files

Closes gh-19041
2020-09-13 22:40:05 -07:00
Phillip Webb c6a9696dd1 Polish 'Fix signed jar performance issues'
Update the performance improvements to push certificate loading
and storage into the `JarFileEntries` class. This allows us to
keep certificates without needing to cache all entry data. We
now also keep certificates and code signers in a dedicated class
which is set whenever the full jar stream as been read, even if
the contained values are `null`. The logic that assumes META-INF
entries are not signed has been removed in favor of delegating to
the streamed entry results.

See gh-19041
2020-09-13 22:28:45 -07:00
mathieufortin01 4d053e15d8 Fix signed jar performance issues
Update Spring Boot nested JarFile support to improve the performance of
signed jars. Prior to this commit, `certificates` and `codeSigners`
were read by streaming the entire jar whenever the existing values
were `null`. Unfortunately, the contract for `getCertificates` and
get `getCodeSigners` states that `null` is a valid return value. This
meant that full jar streaming would occur whenever either method was
called on an entry that had no result. The problem was further
exacerbated by the fact that entries might not be cached.

See gh-19041
2020-09-13 22:14:03 -07:00
Andy Wilkinson e7e77a917f Align PropertiesLauncher's close behavior with JarLauncher
Previously, PropertiesLauncher would close each archive that it
iterated over when creating its ClassLoader. This was not aligned
with JarLauncher's behaviour and left the ClassLoader with closed
archives. The close was introduced in [1] and became more apparent
following the change to fail operations on closed archives [2].

This commit updates Launcher to remove the close() that was added in
[1]. This aligns the behavior of PropertiesLauncher with JarLauncher
and ensures that the ClassLoader does not have entries backed by
closed archives on its classpath.

Fixes gh-23165

[1] ad72f86bdb
[2] ed7a5db174
2020-09-10 09:40:44 +01:00
Andy Wilkinson 3e0096e9b1 Use classpath normalizer on antlib's integration test classpath input
Closes gh-23223
2020-09-08 11:38:31 +01:00
Stephane Nicoll 648789ef84 Document that buildpacks use non-root users
Closes gh-21122
2020-09-07 12:41:51 +02:00
Stephane Nicoll ee914624e6 Document buildpacks are configured with target Java version
Closes gh-21796
2020-08-31 16:15:30 +02:00
Stephane Nicoll b80314b44b Document how to customize the jmxPort for Maven integration tests
Closes gh-22401
2020-08-31 10:52:47 +02:00
Scott Frederick bc1834bfdf Ensure layer digest hashes contain 64 characters
This commit ensures that encoded digest hashes for Docker image
layers are zero-padded to the required 64 characters length.

Fixes gh-23132
2020-08-28 17:04:34 -05:00
Scott Frederick 4f1b4c98ae Fail on Docker image load with empty response
In some cases, a call to the Docker image load API will fail but
return a 200 OK response status code and an empty response. This
commit detects that the response from this call is empty and
treats this condition as an error instead of a silent failure.

Fixes gh-23130
2020-08-28 15:18:02 -05:00
Andy Wilkinson b57b2f0b44 Test the Gradle Plugin against 6.5 and 6.6
Closes gh-23075
2020-08-25 12:01:25 +01:00
Scott Frederick 56bc0eb9e0 Use canonical path for CNB builder lifecycle binaries
This commit changes the path used to invoke lifecycle binaries in
CNB builders from `/lifecycle` to `/cnb/lifecycle` to conform to
the CNB spec. This will ensure the build plugin image-building
goals and tasks are compatible with future versions of builders
that may not support both paths.

See gh-23009
2020-08-19 16:11:59 -05:00
Phillip Webb 8fd9c685a2 Reduce HTTP debug logging when building image
Update `BuildImageMojo` so that commons HTTP wire logging is configured
to ERROR. Without this update, running `mvn -X` will produce a great
deal of logging since by default HTTP Client logs all bytes transfered
at DEBUG and Maven will enable DEBUG for all logs.

Closes gh-22674
2020-08-19 13:20:06 -07:00
Phillip Webb 73038267a0 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:34:06 -07:00
Phillip Webb 17e2d72bcb Fix Windows path issue in JarFileWrapperTests
See gh-22991
2020-08-19 10:33:23 -07:00
Phillip Webb 8722c2c5de Close writer after use in ExtractCommandTests
Update `ExtractCommandTests` so that the writer is closed after the
contents have been written.

See gh-22993
2020-08-19 10:25:37 -07:00
Phillip Webb 0dd38a7264 Merge branch '2.2.x' into 2.3.x 2020-08-19 10:22:45 -07:00