Previously, querying the artifact's extension in
SinglePublishedArtifact would result in eager creation of the task
that creates the artifact. Typically, this is the bootWar task.
Instead of querying the extension, this commit reworks
SinglePublishedArtifact and its callers to call separate methods for
jar and war artifacts so that the extension check is no longer
required.
Tests have been added to ensure that running help does not trigger
any unexpected task creation. The tests' assertions tolerate some
variation in behavior that depend on the version of Gradle and
whether the configuration cache is enabled.
Closes gh-30211
The changes for gh-28562 attempted to align the Gradle plugin's
handling of META-INF with the Maven plugin's behavior. Unfortunately,
they want too far, applying the handling to both jar and war files
when the Maven plugin only applies it to jar files.
This commit reworks the changes so that they only apply to jar files.
Closes gh-30026
Previously, the classpath of bootJar, bootWar, and bootRun was
configured directly as a FileCollection derived from the main source
set's runtime classpath. This direct configuration meant that
subsequent changes to the main source set's runtime classpath may not
have been picked up.
This commit changes the configuration of the classpath to use a
Callable. This indirection allows subsequent changes to the main
source set's runtime classpath to be picked up as long as they
occur before Gradle calls the callable.
Closes gh-29672
Update the Maven and Gradle packaging for war files so that a
`classpath.idx` file is written into the archive that provides the
original order of the classpath, as was previously done for jar files.
The `WarLauncher` class will use this file when running as an exploded
archive to ensure that the classpath order is the same as when running
from the far war.
Fixes gh-19875
This commit adds configuration to the Maven and Gradle plugins to
allow specifying the names of build and launch cache volumes provided
to the CNB builder.
See gh-28292
Update Maven and Gradle plugins to allow build info properties to be
excluded.
Prior to this commit, the `BuildPropertiesWriter` would fail with an
NPE if the group, artifact, name or version properties were `null`.
This was specifically problematic with the Gradle plugin, since its
DSL allows `null` properties which would either be passed to the writer
or, in the case of `artifact`, converted into a string value of
"unspecified".
See gh-27412
This commit adds configuration to the Maven and Gradle plugins to
allow specifying multiple tag to be created that refer to the built
image.
See gh-27613
Previously, the optional configuration was added to the compile and
runtime classpaths of each source set and the the javadoc classpath
as well. This had a few disadvantages, the most notable of which is
that it meant that the configuration was ifrst resolved and then
the outcome of the resolution was added to the compile and runtime
classpaths. As a result, none of the attributes on the compile and
runtime classpaths were considered to influence variant selection.
This commit reworks the optional dependencies plugin so that the
compile and runtime classpaths of each source set are now configured
to extend from the optional configuration. This allows each
classpath configuration's attributes to influence the dependencies
that are selected from the optional configuration during resolution.
For example, when resolving the compile classpath, compile
dependencies (Usage.JAVA_API) will be selected and when resolving the
runtime classpath, runtime dependencies (Usage.JAVA_RUNTIME) will be
selected.
The above-described change means that runtime dependencies of an
optional dependencies will no longer leak into the compile classpath.
As a result of this, our Gradle plugin's test infrastructure has
been updated so that it no longer references runtime dependencies of
the Kotlin Gradle plugin at compile time.
Closes gh-27965
This commit adds configuration to the Maven and Gradle plugins to
allow specifying the network mode to be provided to the image
building goal and task.
See gh-27486
An upgrade to Apache Commons Compress allows the build plugins to write
the launch script to the fat jar as a proper preamble, making the file
compatible with more jar and zip tooling.
Fixes gh-22336
A new system test plugin is being made available for running test
suites that should be run less frequently than with every commit, such
as tests that verify Spring Boot compatibility with external
projects. CI pipeline configuration for running system tests is also
provided.
The first system tests verify the behavior of the Spring Boot image
building plugins when building images using Paketo buildpacks.
Closes gh-25824
Update `RepackageMojo` and supporting classes so that `exclusions`
on the repackage goal apply to both the contributed libraries and any
existing jar entries already contained in the original war.
Prior to this commit, exclusions would apply to contributed jars (for
example, those in `WEB-INF/lib-provided`) but not jars that were
packaged directly into `WEB-INF/lib` by the war plugin
Fixes gh-15808
Co-authored-by: Phillip Webb <pwebb@vmware.com>
Previously, a project with a dependency on Spring Boot's configuration
processor would fail to build when the configuration cache is enabled
due to it accessing the Project during task execution.
Instead of accessing the project during task execution, this commit
updates the code to retrieve the resource locations from the matching
source set in advance. The locations are then stored in the action
that configures the compile task when needed.
Closes gh-26880
Using the revision line means that the revision number is automatically
set. The revision number is then included by the HTML and PDF backends
in the standard location. In the HTML backend that's alongside the
list of authors. In the PDF backend that's on the title page.
Closes gh-26851
7.1-rc-1 deprecates JavaExec's main property in favor of mainClass
which was introduced in Gradle 6.4. This commit updates some tests
to use mainClass rather than main that would otherwise have failed
due to deprecation warnings in their output.
Closes gh-26793
When a custom buildpack is provided for image building, the contents
of the buildpack directory, tgz file, or image are copied as tar
entries to a new layer in the ephemeral builder image. Prior to this
commit, only file entries from the buildpack source were copied as
builder layer tar entries; intermediate directory entries from the
source were not copied. This results in directories being created in
the builder container using default permissions. This worked on most
Linux-like OSs where the default permissions allow others-read
access. On some OSs like Arch Linux where the default directory
permissions do not allow others-read, this prevented the lifecycle
processes from reading the buildpack files.
This commit explicitly creates all intermediate directory tar entries
in the builder image layer to ensure that the buildpack directories
and files can be read by the lifecycle processes.
Fixes gh-26658
Change `SpringBootPlugin.PRODUCTION_RUNTIME_CLASSPATH_NAME` from package
private to public so that it can be accessed in user build scripts.
Fixes gh-26686
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