@ -22,7 +22,6 @@ import java.util.Map;
import org.gradle.api.Action ;
import org.gradle.api.Action ;
import org.gradle.api.DefaultTask ;
import org.gradle.api.DefaultTask ;
import org.gradle.api.JavaVersion ;
import org.gradle.api.Project ;
import org.gradle.api.Project ;
import org.gradle.api.Task ;
import org.gradle.api.Task ;
import org.gradle.api.file.RegularFileProperty ;
import org.gradle.api.file.RegularFileProperty ;
@ -66,8 +65,6 @@ import org.springframework.util.StringUtils;
@DisableCachingByDefault
@DisableCachingByDefault
public abstract class BootBuildImage extends DefaultTask {
public abstract class BootBuildImage extends DefaultTask {
private static final String BUILDPACK_JVM_VERSION_KEY = "BP_JVM_VERSION" ;
private final Property < PullPolicy > pullPolicy ;
private final Property < PullPolicy > pullPolicy ;
private final String projectName ;
private final String projectName ;
@ -107,15 +104,6 @@ public abstract class BootBuildImage extends DefaultTask {
@PathSensitive ( PathSensitivity . RELATIVE )
@PathSensitive ( PathSensitivity . RELATIVE )
public abstract RegularFileProperty getArchiveFile ( ) ;
public abstract RegularFileProperty getArchiveFile ( ) ;
/ * *
* Returns the target Java version of the project ( e . g . as provided by the
* { @code targetCompatibility } build property ) .
* @return the target Java version
* /
@Input
@Optional
public abstract Property < JavaVersion > getTargetJavaVersion ( ) ;
/ * *
/ * *
* Returns the name of the image that will be built . When { @code null } , the name will
* Returns the name of the image that will be built . When { @code null } , the name will
* be derived from the { @link Project Project ' s } { @link Project # getName ( ) name } and
* be derived from the { @link Project Project ' s } { @link Project # getName ( ) name } and
@ -340,9 +328,6 @@ public abstract class BootBuildImage extends DefaultTask {
if ( environment ! = null & & ! environment . isEmpty ( ) ) {
if ( environment ! = null & & ! environment . isEmpty ( ) ) {
request = request . withEnv ( environment ) ;
request = request . withEnv ( environment ) ;
}
}
if ( this . getTargetJavaVersion ( ) . isPresent ( ) & & ! request . getEnv ( ) . containsKey ( BUILDPACK_JVM_VERSION_KEY ) ) {
request = request . withEnv ( BUILDPACK_JVM_VERSION_KEY , translateTargetJavaVersion ( ) ) ;
}
return request ;
return request ;
}
}
@ -401,8 +386,4 @@ public abstract class BootBuildImage extends DefaultTask {
return request ;
return request ;
}
}
private String translateTargetJavaVersion ( ) {
return this . getTargetJavaVersion ( ) . get ( ) . getMajorVersion ( ) + ".*" ;
}
}
}