|
|
|
@ -16,9 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.gradle; |
|
|
|
package org.springframework.boot.gradle; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedWriter; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileWriter; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
|
|
import org.gradle.tooling.GradleConnector; |
|
|
|
import org.gradle.tooling.GradleConnector; |
|
|
|
@ -48,8 +46,7 @@ public class ProjectCreator { |
|
|
|
projectDirectory.mkdirs(); |
|
|
|
projectDirectory.mkdirs(); |
|
|
|
|
|
|
|
|
|
|
|
File gradleScript = new File(projectDirectory, "build.gradle"); |
|
|
|
File gradleScript = new File(projectDirectory, "build.gradle"); |
|
|
|
writeGradleProperties(projectDirectory); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (new File("src/test/resources", name).isDirectory()) { |
|
|
|
if (new File("src/test/resources", name).isDirectory()) { |
|
|
|
FileSystemUtils.copyRecursively(new File("src/test/resources", name), |
|
|
|
FileSystemUtils.copyRecursively(new File("src/test/resources", name), |
|
|
|
projectDirectory); |
|
|
|
projectDirectory); |
|
|
|
@ -65,21 +62,4 @@ public class ProjectCreator { |
|
|
|
((DefaultGradleConnector) gradleConnector).embedded(true); |
|
|
|
((DefaultGradleConnector) gradleConnector).embedded(true); |
|
|
|
return gradleConnector.forProjectDirectory(projectDirectory).connect(); |
|
|
|
return gradleConnector.forProjectDirectory(projectDirectory).connect(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void writeGradleProperties(File projectDirectory) throws IOException { |
|
|
|
|
|
|
|
File gradleProperties = new File(projectDirectory, "gradle.properties"); |
|
|
|
|
|
|
|
BufferedWriter writer = new BufferedWriter(new FileWriter(gradleProperties)); |
|
|
|
|
|
|
|
writeProperty(writer, "http.proxyHost"); |
|
|
|
|
|
|
|
writeProperty(writer, "https.proxyHost"); |
|
|
|
|
|
|
|
writeProperty(writer, "http.proxyPort"); |
|
|
|
|
|
|
|
writeProperty(writer, "https.proxyPort"); |
|
|
|
|
|
|
|
writer.close(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void writeProperty(BufferedWriter writer, String name) throws IOException { |
|
|
|
|
|
|
|
String value = System.getProperty(name); |
|
|
|
|
|
|
|
if (value != null) { |
|
|
|
|
|
|
|
writer.write("systemProp." + name + "=" + value + "\n"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|