void () { File targetDir = new File(myMavenProject.getBuildDirectory()); List<String> facetExcludes = new NotNullList<>(); for (MavenImporter each : MavenImporter.getSuitableImporters(myMavenProject)) { each.collectExcludedFolders(myMavenProject, facetExcludes); } for (String eachFolder : facetExcludes) { myModel.unregisterAll(eachFolder, true, true); myModel.addExcludedFolder(eachFolder); } if (myImportingSettings.isExcludeTargetFolder()) { myModel.addExcludedFolder(targetDir.getPath()); } }