void (boolean test) { File targetDir = new File(myMavenProject.getBuildDirectory()); String generatedDir = test ? myMavenProject.getGeneratedSourcesDirectory(true) : myMavenProject.getGeneratedSourcesDirectory(false); myModel.unregisterAll(targetDir.getPath(), false, false); if (myImportingSettings.getGeneratedSourcesFolder() != MavenImportingSettings.GeneratedSourcesFolder.IGNORE) { if (test) { myModel.addGeneratedJavaSourceFolder(myMavenProject.getAnnotationProcessorDirectory(true), JavaSourceRootType.TEST_SOURCE); } else { myModel.addGeneratedJavaSourceFolder(myMavenProject.getAnnotationProcessorDirectory(false), JavaSourceRootType.SOURCE); } } File[] targetChildren = targetDir.listFiles(); if (targetChildren != null) { for (File f : targetChildren) { if (!f.isDirectory()) continue; if (!test && FileUtil.pathsEqual(generatedDir, f.getPath())) { configGeneratedSourceFolder(f, JavaSourceRootType.SOURCE); } else if (test && FileUtil.pathsEqual(generatedDir, f.getPath())) { configGeneratedSourceFolder(f, JavaSourceRootType.TEST_SOURCE); } } } }