mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-23 12:33:47 +08:00
Auto-updatable version ranges
This commit improves the version format so that the minor and patch elements can hold a special 'x' character besides the version, i.e. `1.x.x.RELEASE` or `2.4.x.BUILD-SNAPSHOT`. A `VersionParser` now takes care to resolve those against a list of known Spring Boot versions. This is particularly useful in version ranges that have to change when the latest Spring Boot versions change. Spring Initializr already auto- udpates itself based on the sagan metadata. When a range is using this feature, it is also automatically updated. It might be hard to track the actual range values on a given instance so an `InfoContributor` is now automatically exposed to list them. Closes gh-328
This commit is contained in:
@@ -55,8 +55,7 @@ class DefaultInitializrMetadataProvider implements InitializrMetadataProvider {
|
||||
if (!bootVersions.find { it.default }) { // No default specified
|
||||
bootVersions[0].default = true
|
||||
}
|
||||
metadata.bootVersions.content.clear()
|
||||
metadata.bootVersions.content.addAll(bootVersions)
|
||||
metadata.updateSpringBootVersions(bootVersions)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,6 @@ import groovy.json.JsonBuilder
|
||||
import io.spring.initializr.metadata.Dependency
|
||||
import io.spring.initializr.metadata.InitializrMetadataProvider
|
||||
import io.spring.initializr.util.Version
|
||||
import io.spring.initializr.util.VersionRange
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.http.MediaType
|
||||
@@ -52,7 +51,7 @@ class UiController {
|
||||
dependencyGroups.each { g ->
|
||||
g.content.each { d ->
|
||||
if (v && d.versionRange) {
|
||||
if (VersionRange.parse(d.versionRange).match(v)) {
|
||||
if (d.match(v)) {
|
||||
content << new DependencyItem(g.name, d)
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user