mirror of
https://gitee.com/dcren/initializr.git
synced 2025-07-15 14:04:30 +08:00
Add optional links to a dependency
See gh-163
This commit is contained in:
parent
9c7bdcc5bf
commit
d8a1927a36
@ -84,13 +84,15 @@ class Dependency extends MetadataElement {
|
|||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
String versionRequirement
|
String versionRequirement
|
||||||
|
|
||||||
private VersionRange range
|
private VersionRange range
|
||||||
|
|
||||||
String bom
|
String bom
|
||||||
|
|
||||||
String repository
|
String repository
|
||||||
|
|
||||||
|
List<Link> links = []
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
|
||||||
int weight
|
int weight
|
||||||
|
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012-2015 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.spring.initializr.metadata
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Dave Syer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class Link {
|
||||||
|
|
||||||
|
String id
|
||||||
|
|
||||||
|
URL url
|
||||||
|
|
||||||
|
String description
|
||||||
|
|
||||||
|
}
|
@ -57,6 +57,9 @@ class DependencyMetadataV21JsonMapper implements DependencyMetadataJsonMapper {
|
|||||||
if (dep.repository) {
|
if (dep.repository) {
|
||||||
result.repository = dep.repository
|
result.repository = dep.repository
|
||||||
}
|
}
|
||||||
|
if (dep.links) {
|
||||||
|
result.links = dep.links
|
||||||
|
}
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,9 @@ class InitializrMetadataV21JsonMapper extends InitializrMetadataV2JsonMapper {
|
|||||||
if (dependency.versionRange) {
|
if (dependency.versionRange) {
|
||||||
content['versionRange'] = dependency.versionRange
|
content['versionRange'] = dependency.versionRange
|
||||||
}
|
}
|
||||||
|
if (dependency.links) {
|
||||||
|
content.links = dependency.links
|
||||||
|
}
|
||||||
content
|
content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +82,10 @@ class UiController {
|
|||||||
if (d.description) {
|
if (d.description) {
|
||||||
result.description = d.description
|
result.description = d.description
|
||||||
}
|
}
|
||||||
|
if (d.links) {
|
||||||
|
result.url = d.links[0].url
|
||||||
|
result.links = d.links
|
||||||
|
}
|
||||||
if (d.weight) {
|
if (d.weight) {
|
||||||
result.weight = d.weight
|
result.weight = d.weight
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user