Promise<Void> (@NotNull Module module, @NotNull final LanguageLevel level) { if (!myProjectsManager.isMavenizedModule(module)) return null; MavenProject mavenProject = myProjectsManager.findProject(module); if (mavenProject == null) return null; final MavenDomProjectModel model = MavenDomUtil.getMavenDomProjectModel(myProject, mavenProject.getFile()); if (model == null) return null; WriteCommandAction.writeCommandAction(myProject, DomUtil.getFile(model)).withName(MavenDomBundle.message("fix.add.dependency")).run(() -> { PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); Document document = documentManager.getDocument(DomUtil.getFile(model)); if (document != null) { documentManager.commitDocument(document); } XmlTag tag = getCompilerPlugin(model).getConfiguration().ensureTagExists(); String option = JpsJavaSdkType.complianceOption(level.toJavaVersion()); setChildTagValue(tag, "source", option); setChildTagValue(tag, "target", option); if (level.isPreview()) { setChildTagValue(tag, "compilerArgs","--enable-preview"); } if (document != null) { FileDocumentManager.getInstance().saveDocument(document); } }); return myProjectsManager.forceUpdateProjects(Collections.singleton(mavenProject)); }