#152 - Fix IoProperties.javaHome setter.

We now correctly set the javaHome variable instead of the workDir if the io.javaHome property is set.
Include the property in the template file and add the maven.parallelize=true flag as well.

Closes: #152
This commit is contained in:
Christoph Strobl
2020-10-15 08:28:51 +02:00
parent 18fb35c4cf
commit fca3466a42
3 changed files with 99 additions and 3 deletions

View File

@@ -22,10 +22,12 @@ import java.io.File;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* @author Oliver Gierke
* @author Mark Paluch
* @author Christoph Strobl
*/
@Slf4j
@Data
@@ -37,13 +39,26 @@ class IoProperties {
public void setWorkDir(String workDir) {
log.info(String.format("Using %s as working directory!", workDir));
log.info(String.format("🔧 Using %s as working directory!", workDir));
this.workDir = new File(workDir.replace("~", System.getProperty("user.home")));
}
public void setJavaHome(String javaHome) {
log.info(String.format("Using %s as Java home!", javaHome));
this.workDir = new File(javaHome.replace("~", System.getProperty("user.home")));
if (!StringUtils.hasText(javaHome)) {
return;
}
File javaHomeDir = new File(javaHome.replace("~", System.getProperty("user.home")));
if (!javaHomeDir.isDirectory()) {
log.warn(String.format(
"⚠️️ Property 'io.javaHome' does not point to a vaild directory ('%s')! Falling back to os.default.",
javaHomeDir.getPath()));
return;
}
log.info(String.format("🔧 Setting javaHome to: '%s'.", javaHomeDir.getPath()));
this.javaHome = javaHomeDir;
}
}