void (MavenArtifact artifact, DependencyScope scope) { assert MavenConstants.SCOPE_SYSTEM.equals(artifact.getScope()); String libraryName = artifact.getLibraryName(); Library library = myRootModel.getModuleLibraryTable().getLibraryByName(libraryName); if (library == null) { library = myRootModel.getModuleLibraryTable().createLibrary(libraryName); } LibraryOrderEntry orderEntry = myRootModel.findLibraryOrderEntry(library); assert orderEntry != null; orderEntry.setScope(scope); Library.ModifiableModel modifiableModel = library.getModifiableModel(); updateUrl(modifiableModel, OrderRootType.CLASSES, artifact, null, null, true); modifiableModel.commit(); if (myOrderEntriesBeforeJdk.contains(libraryName)) { moveLastOrderEntryBeforeJdk(); } }