Allow custom dependency metadata to be used with the CLI
Add support for a new annotation, @GrabMetadata, that can be used
to provide the coordinates of one or more properties files, such as
the one published by Spring IO Platform, as a source of dependency
metadata. For example:
@GrabMetadata("com.example:metadata:1.0.0")
The referenced properties files must be in the format
group:module=version.
Limitations:
- Only a single @GrabMetadata annotation is supported
- The referenced properties file must be accessible in one of the
default repositories, i.e. it cannot be accessed in a repository
that's added using @GrabResolver
Closes #814
This commit is contained in:
@@ -153,6 +153,31 @@ in the Spring Boot CLI source code to understand exactly how customizations are
|
||||
|
||||
|
||||
|
||||
[[cli-default-grab-deduced-coordinates]]
|
||||
==== Deduced ``grab'' coordinates
|
||||
Spring Boot extends Groovy's standard `@Grab` support by allowing you to specify a dependency
|
||||
without a group or version, for example `@Grab('freemarker')`. This will consult Spring Boot's
|
||||
default dependency metadata to deduce the artifact's group and version. Note that the default
|
||||
metadata is tied to the version of the CLI that you're using – it will only change when you move
|
||||
to a new version of the CLI, putting you in control of when the versions of your dependencies
|
||||
may change.
|
||||
|
||||
|
||||
|
||||
[[cli-default-grab-deduced-coordinates-custom-metadata]]
|
||||
===== Custom ``grab'' metadata
|
||||
Spring Boot provides a new annotation, `@GrabMetadata` that can be used to provide custom
|
||||
dependency metadata that overrides Spring Boot's defaults. This metadata is specified by
|
||||
using the new annotation to provide the coordinates of one or more properties files. For example `
|
||||
@GrabMetadata(['com.example:versions-one:1.0.0', 'com.example.versions-two:1.0.0'])`. The
|
||||
properties files are applied in the order that their specified. In the example above, this means
|
||||
that properties in `versions-two` will override properties in `versions-one`. Each entry in
|
||||
each properties file must be in the form `group:module=version`. You can use `@GrabVersions`
|
||||
anywhere that you can use `@Grab`, however, to ensure consistent ordering of the metadata, you
|
||||
can only use `@GrabVersions` at most once in your application.
|
||||
|
||||
|
||||
|
||||
[[cli-default-import-statements]]
|
||||
==== Default import statements
|
||||
To help reduce the size of your Groovy code, several `import` statements are
|
||||
|
||||
Reference in New Issue
Block a user