mirror of
https://gitee.com/dcren/initializr.git
synced 2026-02-26 21:53:14 +08:00
Enable strict validation of dependencies
Previously, if one invokes the service asking for dependency `foo` and `foo` does not exist we created a starter for it, that is `spring-boot-starter-foo`. This mechanism was put in place because we don't know all starters and to offer a nice fallback for users who know what they're doing. That statement proved to be wrong since users actually discover new starters via the service and don't seem to attempt to create such starter that are located in the `org.springframework.boot` groupId anyway. Most if not all of those are pilot errors. This commit enables strict validation of dependencies and generate an appropriate exception if it isn't defined in the meta-data. Closes gh-234
This commit is contained in:
@@ -78,12 +78,7 @@ class ProjectRequest extends BasicProjectRequest {
|
||||
resolvedDependencies = depIds.collect {
|
||||
def dependency = metadata.dependencies.get(it)
|
||||
if (dependency == null) {
|
||||
if (it.contains(':')) {
|
||||
throw new InvalidProjectRequestException("Unknown dependency '$it' check project metadata")
|
||||
}
|
||||
log.warn("No known dependency for style '$it' assuming spring-boot-starter")
|
||||
dependency = new Dependency()
|
||||
dependency.asSpringBootStarter(it)
|
||||
throw new InvalidProjectRequestException("Unknown dependency '$it' check project metadata")
|
||||
}
|
||||
dependency.resolve(requestedVersion)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user