Create a settings.gradle file for Gradle projects

See gh-643
This commit is contained in:
Chris Vogel
2018-03-28 21:11:24 -05:00
committed by Stephane Nicoll
parent 995e2920f3
commit aa75b1efaa
2 changed files with 8 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ import org.springframework.util.StreamUtils;
* @author Stephane Nicoll
* @author Sebastien Deleuze
* @author Andy Wilkinson
* @author Chris Vogel
*/
public class ProjectGenerator {
@@ -219,6 +220,8 @@ public class ProjectGenerator {
if (isGradleBuild(request)) {
String gradle = new String(doGenerateGradleBuild(model));
writeText(new File(dir, "build.gradle"), gradle);
String settings = new String(doGenerateGradleSettings(model));
writeText(new File(dir, "settings.gradle"), settings);
writeGradleWrapper(dir, Version.safeParse(request.getBootVersion()));
}
else {
@@ -600,6 +603,10 @@ public class ProjectGenerator {
return templateRenderer.process("starter-build.gradle", model).getBytes();
}
private byte[] doGenerateGradleSettings(Map<String, Object> model) {
return templateRenderer.process("starter-settings.gradle", model).getBytes();
}
private void writeGradleWrapper(File dir, Version bootVersion) {
String gradlePrefix = isGradle4Available(bootVersion) ? "gradle4" :
isGradle3Available(bootVersion) ? "gradle3" : "gradle";

View File

@@ -0,0 +1 @@
rootProject.name = '{{artifactId}}'