Commit Graph

567 Commits (2b7f23b29d0bc4575eb11eaf53ef75d4897f3df2)

Author SHA1 Message Date
Andy Wilkinson 997505005b Handle files larger than Integer.MAX_VALUE bytes in bootJar and bootWar
Fixes gh-24618
4 years ago
Andy Wilkinson 5ae9fbedcd Merge branch '2.3.x' into 2.4.x
Closes gh-24738
4 years ago
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
4 years ago
Andy Wilkinson 3c3aa9e486 Merge branch '2.3.x' into 2.4.x
Closes gh-24735
4 years ago
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
4 years ago
Andy Wilkinson 9e389c8376 Merge branch '2.3.x' into 2.4.x
Closes gh-24710
4 years ago
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
4 years ago
Scott Frederick dfcabe1665 Merge branch '2.3.x' into 2.4.x
Fixes gh-24521 in 2.4.2
4 years ago
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
4 years ago
Andy Wilkinson 5fdb2ae2fd Protect PluginApplicationActions against absent plugin classes
Closes gh-24526
4 years ago
Phillip Webb 72d36e0c07 Update copyright year of changed files 4 years ago
Phillip Webb 30c27274e2 Merge branch '2.3.x'
Closes gh-24339
4 years ago
Phillip Webb 5f351a6983 Merge branch '2.2.x' into 2.3.x
Closes gh-24338
4 years ago
Phillip Webb 837fc83527 Fix checkstyle header violations
See gh-24337
4 years ago
Scott Frederick da2276e7d4 Use stable builder and run images in integration tests
Fixes gh-24183
4 years ago
Scott Frederick 59e0f7317e Avoid image pulls in integration tests
This commit sets the pull policy to `IF_NOT_PRESENT` where possible
in integration tests for the Maven and Gradle plugins to reduce
the number of times the default Paketo builder and run images are
pulled from Docker Hub.

Fixes gh-24113
4 years ago
Stephane Nicoll b6fc0913cf Merge branch '2.3.x'
Closes gh-24104
4 years ago
Stephane Nicoll 515b18e142 Merge branch '2.3.x'
Closes gh-24108
4 years ago
Andy Wilkinson 409e3ccecf Ignore resolution of copied configuration
When a Configuration is copied, any before and after resolve actions
that are registered with its ResolvableDependencies are also copied
over. This means that, when a copied configuration is resolved the
resolution actions may be called on a ResolvableDependencies instances
that isn't the one to which they were added.

Previously, the above-described Gradle behaviour would result in
BootJar accessed the ResolvedConfiguration of a Configuration that may
not have yet been resolved. At best this would trigger Configuration
resolution and at worst it would fail. A failure could occur if the
configuration had been copied so that it could be made resolvable.
The afterResolve action would then try to access the
ResolvedConfiguration of the original Configuration. This would trigger
a resolution attempt that fails due to the original configuration being
marked as unresolvable.

This commit updates the afterResolve action in BootJar to check that
the ResolvableDependencies with which it is called matches the
ResolvableDependencies with which it was original registered. Only
when the two match, and therefore the configuration has actually been
resolved, does processing proceed.

Fixes gh-24072
4 years ago
Andy Wilkinson c85cc33ca9 Fix main class resolution failure when loaded from config cache
See gh-22922
4 years ago
Andy Wilkinson 7cbcd42eba Adapt test to cope with increased Instant precision on Java 11
See gh-22922
4 years ago
Andy Wilkinson 4a4fec6310 Avoid calling getProject() during BootBuildImage's execution
See gh-22922
4 years ago
Andy Wilkinson c409d50c14 Document support for Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson 806464edd1 Update BootBuildImage to support Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson b1c4af4081 Update bootJar and bootWar to use new main class resolution mechanism
See gh-22922
4 years ago
Andy Wilkinson c078a48064 Update BootRun to support Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson d1f543fc1d Update BuildInfo to support Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson 83cfd3b2e6 Update BootWar to support Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson 081ef2d905 Update BootJar to support Gradle's configuration cache
See gh-22922
4 years ago
Andy Wilkinson c828521912 Allow tests to provide properties that modify the build.gradle script
See gh-22922
4 years ago
Andy Wilkinson d136324b99 Add support for testing the Gradle plugin with --configuration-cache
See gh-22922
4 years ago
Andy Wilkinson 0aa0cba3f7 Fix content filters when excludeProjectDependencies() is used
Fixes gh-23763
4 years ago
olivier.antoine ded2a8006a Expose BootBuildImage's cleanCache property as a command-line option
See gh-23753
4 years ago
Andy Wilkinson 0f069ee9c6 Merge branch '2.3.x'
Closes gh-23756
4 years ago
Andy Wilkinson 633027b1cd Upgrade to Gradle 6.7
Closes gh-23754
4 years ago
Andy Wilkinson 6898a97102 Merge branch '2.3.x'
Closes gh-23732
4 years ago
Andy Wilkinson 11b5e86ffd Deprecate BootJar#getConfigurations
Fixes gh-23527
4 years ago
Andy Wilkinson 84f96033c5 Put project deps in app layer and make customization easier
Previously, when building a layered jar with Gradle, project
dependencies were treated the same as any other dependency, being
included in the dependencies or snapshot dependencies layer based
on their version.

This commit updates the default layering when using Gradle to include
project dependencies in the application layer by default. The DSL has
also been updated to allow their layer to be customized using new
includeProjectDependencies() and excludeProjectDependencies() methods
rather than relying on including and excluding them via a
group:artifact:version pattern.

Closes gh-23431
4 years ago
Johnny Lim 4a26e11268 Polish
See gh-23634

Closes gh-23634
4 years ago
Scott Frederick 0e7ab88491 Polish "Update default builder image"
See gh-23628
4 years ago
Emily Casey 461dc23c0c Update default builder image
This commit updates the default builder image used by the Maven
and Gradle plugins image-building goal and task to use the latest
Paketo builder image. The builder image is pulled from Docker Hub
instead of Google Container Registry by default.

See gh-23628
4 years ago
Scott Frederick f2721abf31 Merge branch '2.3.x'
Closes gh-23626
4 years ago
Scott Frederick de685bdca4 Document buildpack configuration of JVM options
Fixes gh-21582
4 years ago
Scott Frederick a099cd9420 Merge branch '2.3.x'
Closes gh-23623
4 years ago
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
4 years ago
Andy Wilkinson 70ed7784a6 Use Property<String>s for main class configuration in the Gradle plugin
Closes gh-23608
4 years ago
Scott Frederick 91acd957b2 Disable docker registry integration tests
A docker registry running in testcontainers behaves
differently in CI vs running locally. Disabling the tests for
now while working on getting them running reliably in CI.

See gh-21001
4 years ago
Scott Frederick 09b627d232 Add support for publishing docker images to a registry
This commit adds options to the Maven and Gradle plugins to publish
to a Docker registry the image generated by the image-building goal
and task.

The Docker registry auth configuration added in an earlier commit
was modified to accept separate auth configs for the builder/run
image and the generated image, since it is likely these images will
be stored in separate registries or repositories with distinct
auth required for each.

Fixes gh-21001
4 years ago
Andy Wilkinson b7d020d3c2 Merge branch '2.3.x' 4 years ago
Andy Wilkinson 543763462c Update tests to look for snippets in correct location
See gh-23598
4 years ago
Andy Wilkinson f44889b992 Merge branch '2.3.x'
See gh-23599
4 years ago
Andy Wilkinson 7eb92cc71a More Gradle snippets to correct location
See gh-23598
4 years ago
Andy Wilkinson 94884f201c Merge branch '2.3.x'
Closes gh-23599
4 years ago
Andy Wilkinson 2d3291fb83 Merge branch '2.2.x' into 2.3.x
Closes gh-23598
4 years ago
Andy Wilkinson 7ac14203ab Expand Gradle plugin's docs on setting bootRun's system properties
Closes gh-23578
4 years ago
Andy Wilkinson e58a92b3d0 Introduce a dedicated @GradleCompatibility annotation
Rather than using the extension directly, introduced a dedicated
annotation will enable customization of the compatibility tests that
are run via attributes on the annotation. For example, it will allow
certain test classes to run their tests with Gradle's configuration
cache enabled while others disable it.

Closes gh-23532
4 years ago
Andy Wilkinson f5df6e463a Reduce configuration resolution when building a layered jar
Previously, BootJar would resolves all of a project's configurations
when building a layered jar. This was unnecessarily broad as it was
likely to include configurations that had contributed nothing to the
jar's classpath.

This commit replaces the configuration resolution with an afterResolve
action that populates the ResolvedDependencies in response to a
configuration being resolved. This allows the resolved dependencies to
be populated from all of the configurations that were resolved as part
of determining the jars classpath and no more.

Closes gh-23528
4 years ago
Lukas Cardot e95bcfac34 Configure the bootBuildInfo task lazily
Prior to this commit, the bootBuildInfo was configured eagerly.
Configuring it lazily prevent this task from being configured when not
explicitly needed. Also, the 'classes' and 'bootJar' tasks are now
lazily configured, as the bootBuildInfo task was causing them to be
configured eagerly.

See gh-23435
4 years ago
Andy Wilkinson b662f1e06e Remove UnresolvedDependenciesAnalyzer from the Gradle plugin
Closes gh-23479
4 years ago
Andy Wilkinson 9ecc548672 Merge branch '2.3.x'
Closes gh-23427
4 years ago
Andy Wilkinson 8667e9ded8 Merge branch '2.2.x' into 2.3.x
Closes gh-23426
4 years ago
Andy Wilkinson 581190d7a0 Test the Gradle plugin against 6.7-rc-1
Closes gh-23425
4 years ago
Andy Wilkinson 0f2ddd6480 Merge branch '2.3.x'
Closes gh-23423
4 years ago
Andy Wilkinson d06af28cd8 Merge branch '2.2.x' into 2.3.x
Closes gh-23422
4 years ago
Andy Wilkinson 360e29af48 Polish "Add note about Kotlin main class name"
See gh-23418
4 years ago
Sebastiaan Fernandez 0bde5fda9b Add note about Kotlin main class name
See gh-23418
4 years ago
Scott Frederick 54288678d1 Configure Docker host in build plugins
This commit adds the ability to configure the Maven and Gradle
plugins to use a remote Docker daemon using build file
configuration, as an alternative to setting environment variables
to specify remote host connection details.

Fixes gh-23400
4 years ago
Andy Wilkinson d2fae6e19e Merge branch '2.3.x'
Closes gh-23407
4 years ago
Andy Wilkinson 3861ef13fb Merge branch '2.2.x' into 2.3.x
Closes gh-23406
4 years ago
Andy Wilkinson 5ec673ff2a Add anchors to section headers in Gradle plugin docs
Fixes gh-23402
4 years ago
Scott Frederick 86fa8144f5 Polish "Support authentication to private Docker registry"
See gh-22972
4 years ago
姜为 e8f555e13d Support authentication to private docker registry
This commit adds the ability to configure Docker image registry
authentication credentials in the Maven and Gradle plugins. The
authentication credentials are passed to the Docker daemon with
all daemon API calls, and the daemon forwards the credentials to the
image registry when necessary. This makes it possible to use
builder and run images stored in a private Docker registry.

See gh-22972
4 years ago
Stephane Nicoll f03ed3b2a7 Publish single page doc to /htmlsingle consistently
Closes gh-21585
4 years ago
Andy Wilkinson 143d19754b Exclude starter jars when running and packaging with Gradle
This commit updates the Gradle Plugin to filter dependencies based on
the Spring-Boot-Jar-Type entry in their manifest. Jars with a
Spring-Boot-Jar-Type of dependencies-starter are excluded. Unlike the
Maven plugin, jars with a type of annotation-processor are not
excluded. It is not necessary with Gradle as use of the
annotationProcessor configuration for such dependencies already ensures
that they are not included.

See gh-22036
4 years ago
Stephane Nicoll defa7c47cd Merge branch '2.3.x'
Closes gh-23201
4 years ago
Stephane Nicoll 648789ef84 Document that buildpacks use non-root users
Closes gh-21122
4 years ago
EruDev ffc577b499 Simplify code
See gh-23111
4 years ago
Stephane Nicoll cc5f2537b1 Merge branch '2.3.x'
Closes gh-23148
4 years ago
Stephane Nicoll ee914624e6 Document buildpacks are configured with target Java version
Closes gh-21796
4 years ago
Andy Wilkinson 9dc5b88949 Polish "Mark bootArchives configuration as unresolvable"
See gh-22943
4 years ago
Martin Chalupa 796307a78c Mark bootArchives configuration as unresolvable
See gh-22943
4 years ago
Andy Wilkinson b57b2f0b44 Test the Gradle Plugin against 6.5 and 6.6
Closes gh-23075
4 years ago
Stephane Nicoll f8265e3e44 Merge branch '2.3.x'
Closes gh-22980
4 years ago
Jean-Baptiste Nizet 27528fdd07 Fix custom image name example and documentation
There is no `artifactId` property in a gradle Project, and the default
value uses the project name.

See gh-22918
4 years ago
Stephane Nicoll b1e631e8a6 Remove trailing whitespaces 4 years ago
Scott Frederick 7c7079f91a Merge branch '2.3.x' 4 years ago
Scott Frederick 4c6a722f18 Fix test for Java version in image building docs
See gh-22916
4 years ago
Scott Frederick 092bbd198e Merge branch '2.3.x'
Closes gh-22923
4 years ago
Scott Frederick 005ed8b8db Use Java version wildcard in image building docs
Fixes gh-22916
4 years ago
Scott Frederick 6b15822cb1 Polish "Add pullPolicy option for image building"
See gh-22736
4 years ago
anshlykov c7449b57ce Add pullPolicy option for image building
This commit adds a pullPolicy option to the configuration of the Maven
plugin spring-boot:build-image goal and the Gradle plugin bootBuildImage
task. The new option gives users control over pulling the builder image
and run image from a remote image registry to the local Docker daemon.

See gh-22736
4 years ago
Andy Wilkinson fff9193860 Merge branch '2.3.x'
Closes gh-22917
4 years ago
Andy Wilkinson f43a0b4891 Fix configuration of environment in Kotlin bootBuildImage examples
Fixes gh-22913
4 years ago
Andy Wilkinson 9a2d2effa5 Merge branch '2.3.x'
Closes gh-22907
4 years ago
Andy Wilkinson 1381929525 Upgrade to Gradle 6.6
Closes gh-22905
4 years ago
Andy Wilkinson 079b5d3f50 Polish Gradle plugin after layering being enabled by default
Closes gh-20983
4 years ago
Madhura Bhave 41f5ba9077 Switch layering on by default
Closes gh-20983
4 years ago
Andy Wilkinson d2926e0222 Merge branch '2.3.x'
Closes gh-22678
4 years ago
Andy Wilkinson 00cd8945d5 Document how to use Gradle's native bom support
Closes gh-21570
4 years ago
Andy Wilkinson 19ad163486 Merge branch '2.3.x'
Closes gh-22411
4 years ago