Skip to content

Commit be90554

Browse files
authored
Add support for default-for attribute (#275)
This new index.json attribute is designed to allow more flexible version matching to avoid breakage due to switching on the latest version for untested ones. It should have a `default-for` key and a regexp as a string value, for example "1\\.0\\..*" which should match versions like 1.0.0, 1.0.1, 1.0.2, etc. Closes #62
1 parent 5553adb commit be90554

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

CONTRIBUTING.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ It should contain the following entries:
7979
```json
8080
[
8181
{
82-
"latest": false,
8382
"metadata-version": "0.0.1",
8483
"module": "org.example:library",
8584
"tested-versions": [
@@ -106,8 +105,23 @@ The `override` flag allows to express the intent to exclude outdated builtin met
106105
So, the metadata for `org.example:library:0.0.1` and `org.example:library:0.0.2` is located
107106
at `metadata/org.example/library/0.0.1`.
108107

109-
Make sure that each supported version is listed in `tested-versions`, as that value is used in build tools to match
110-
metadata to a specific library.
108+
For entries without `"latest": true`, it is recommended to define the optional `default-for` key with a value containing
109+
a regexp (Java format) matching the version pattern. For example, for the example above, the first entry could be:
110+
111+
```json
112+
{
113+
"metadata-version": "0.0.1",
114+
"module": "org.example:library",
115+
"tested-versions": [
116+
"0.0.1",
117+
"0.0.2"
118+
],
119+
"default-for": "0\\.0\\..*"
120+
}
121+
```
122+
123+
You can also list each supported version is listed in `tested-versions`, as that value is used in build tools to match
124+
metadata to a specific library, but this is more likely to break when new versions are released.
111125
Every metadata for a specific library version has a `index.json`. For this
112126
example `metadata/org.example/library/0.0.1/index.json` would contain:
113127

metadata/org.hibernate.orm/hibernate-core/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
},
1010
{
1111
"metadata-version": "6.1.1.Final",
12+
"default-for": "6\\.1\\..*",
1213
"module": "org.hibernate.orm:hibernate-core",
1314
"tested-versions": [
1415
"6.1.1.Final"

0 commit comments

Comments
 (0)