use of com.intellij.openapi.externalSystem.service.execution.ExternalSystemJdkException in project intellij-community by JetBrains.
the class GradleInstallationManager method doGetGradleJdk.
@Nullable
private Sdk doGetGradleJdk(@Nullable Project project, String linkedProjectPath) {
if (project == null) {
return null;
}
final GradleProjectSettings settings = GradleSettings.getInstance(project).getLinkedProjectSettings(linkedProjectPath);
if (settings == null) {
return null;
}
final String gradleJvm = settings.getGradleJvm();
final Sdk sdk;
try {
sdk = ExternalSystemJdkUtil.getJdk(project, gradleJvm);
} catch (ExternalSystemJdkException e) {
throw new ExternalSystemJdkException(String.format("Invalid Gradle JDK configuration found. <a href='%s'>Open Gradle Settings</a> \n", OpenExternalSystemSettingsCallback.ID), linkedProjectPath, e, OpenExternalSystemSettingsCallback.ID);
}
if (sdk == null && gradleJvm != null) {
throw new ExternalSystemJdkException(String.format("Invalid Gradle JDK configuration found. <a href='%s'>Open Gradle Settings</a> \n", OpenExternalSystemSettingsCallback.ID), linkedProjectPath, null, OpenExternalSystemSettingsCallback.ID);
}
final File sdkHomePath = sdk != null && sdk.getHomePath() != null ? new File(sdk.getHomePath()) : null;
if (sdkHomePath != null && JdkUtil.checkForJre(sdkHomePath.getPath()) && !JdkUtil.checkForJdk(sdkHomePath)) {
throw new ExternalSystemJdkException(String.format("Please, use JDK instead of JRE for Gradle importer. <a href='%s'>Open Gradle Settings</a> \n", OpenExternalSystemSettingsCallback.ID), linkedProjectPath, null, OpenExternalSystemSettingsCallback.ID);
}
return sdk;
}
Aggregations