public static String javaVersion(JavaVersion version) { return version.getMajorVersion(); }
@Override public String getVersion() { return this.javaVersion.getMajorVersion(); }
public static void assertUsingVersion(String component, JavaVersion minVersion, JavaVersion configuredVersion) throws UnsupportedJavaRuntimeException { if (configuredVersion.compareTo(minVersion) >= 0) { return; } throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. Your build is currently configured to use Java %s.", component, GradleVersion.current().getVersion(), minVersion.getMajorVersion(), configuredVersion.getMajorVersion())); } }
public static void assertUsingVersion(String component, JavaVersion minVersion, JavaVersion configuredVersion) throws UnsupportedJavaRuntimeException { if (configuredVersion.compareTo(minVersion) >= 0) { return; } throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. Your build is currently configured to use Java %s.", component, GradleVersion.current().getVersion(), minVersion.getMajorVersion(), configuredVersion.getMajorVersion())); } }
public static String adaptVersionToEclipseNamingConversions(JavaVersion javaVersion) { return javaVersion.isJava9Compatible() ? javaVersion.getMajorVersion() : javaVersion.toString(); } }
public static void assertUsingVersion(String component, JavaVersion minVersion) throws UnsupportedJavaRuntimeException { JavaVersion current = JavaVersion.current(); if (current.compareTo(minVersion) >= 0) { return; } throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. You are currently using Java %s.", component, GradleVersion.current().getVersion(), minVersion.getMajorVersion(), current.getMajorVersion())); }
public static void assertUsingVersion(String component, JavaVersion minVersion) throws UnsupportedJavaRuntimeException { JavaVersion current = JavaVersion.current(); if (current.compareTo(minVersion) >= 0) { return; } throw new UnsupportedJavaRuntimeException(String.format("%s %s requires Java %s or later to run. You are currently using Java %s.", component, GradleVersion.current().getVersion(), minVersion.getMajorVersion(), current.getMajorVersion())); }
/** * Locates a stand-alone JRE installation for this JVM. Returns null if not found. */ @Nullable public Jre getStandaloneJre() { if (javaVersion.isJava9Compatible()) { return null; } if (os.isWindows()) { File jreDir; if (javaVersion.isJava5()) { jreDir = new File(javaHome.getParentFile(), "jre" + SystemProperties.getInstance().getJavaVersion()); } else { jreDir = new File(javaHome.getParentFile(), "jre" + javaVersion.getMajorVersion()); } if (jreDir.isDirectory()) { return new DefaultJre(jreDir); } } if (!new File(javaHome, "jre").isDirectory()) { return new DefaultJre(javaHome); } return null; }
void validateAgainstDefaultBaseImageVersion(@Nullable String baseImage) { if (!PluginConfigurationProcessor.usingDefaultBaseImage(baseImage)) { return; } JavaVersion version = JavaVersion.current(); JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class); if (javaPluginConvention != null) { version = JavaVersion.toVersion(javaPluginConvention.getTargetCompatibility()); } if (version.isJava9Compatible()) { throw new GradleException( "Jib's default base image uses Java 8, but project is using Java " + version.getMajorVersion() + "; perhaps you should configure a Java " + version.getMajorVersion() + "-compatible base image using the 'jib.from.image' parameter, or set targetCompatibility = 1.8 in your build configuration"); } }
realOptions.charSet("UTF-8"); String majorVersion = JavaVersion.current().getMajorVersion(); if (Integer.parseInt(majorVersion) < 11) { realOptions.links("https://docs.oracle.com/javase/" + majorVersion + "/docs/api/");