mirror of
https://gitee.com/dcren/initializr.git
synced 2025-09-18 17:48:14 +08:00
Add a way to easily create a Spring Boot starter from id
This commit is contained in:
@@ -45,9 +45,8 @@ class DefaultStarterBuildCustomizer implements BuildCustomizer<Build> {
|
||||
public void customize(Build build) {
|
||||
boolean hasStarter = this.buildResolver.dependencies(build).anyMatch(this::isValidStarter);
|
||||
if (!hasStarter) {
|
||||
Dependency root = new Dependency();
|
||||
Dependency root = Dependency.createSpringBootStarter("");
|
||||
root.setId(DEFAULT_STARTER);
|
||||
root.asSpringBootStarter("");
|
||||
build.dependencies().add(DEFAULT_STARTER, MetadataBuildItemMapper.toDependency(root));
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ public class WarPackagingWebStarterBuildCustomizer implements BuildCustomizer<Bu
|
||||
build.dependencies().add(dependency.getId(), MetadataBuildItemMapper.toDependency(dependency));
|
||||
}
|
||||
// Add the tomcat starter in provided scope
|
||||
Dependency tomcat = new Dependency().asSpringBootStarter("tomcat");
|
||||
Dependency tomcat = Dependency.createSpringBootStarter("tomcat");
|
||||
tomcat.setScope(Dependency.SCOPE_PROVIDED);
|
||||
build.dependencies().add("tomcat", MetadataBuildItemMapper.toDependency(tomcat));
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class WarPackagingWebStarterBuildCustomizer implements BuildCustomizer<Bu
|
||||
|
||||
private Dependency determineWebDependency(InitializrMetadata metadata) {
|
||||
Dependency web = metadata.getDependencies().get("web");
|
||||
return (web != null) ? web : Dependency.withId("web").asSpringBootStarter("web");
|
||||
return (web != null) ? web : Dependency.createSpringBootStarter("web");
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user