GradleVersion (@Nullable IdeaProject ideaProject) { try { ClassLoader classLoader = new ProtocolToModelAdapter().unpack(ideaProject).getClass().getClassLoader(); Class<?> gradleVersionClass = classLoader.loadClass("org.gradle.util.GradleVersion"); Object buildGradleVersion = gradleVersionClass.getMethod("current").invoke(gradleVersionClass); return GradleVersion.version(gradleVersionClass.getMethod("getVersion").invoke(buildGradleVersion).toString()); } catch (Exception ignore) { } return GradleVersion.current(); }