[maven] import to workspace model: don't create duplicating sources roots (IDEA-284414)

GitOrigin-RevId: 75451f034c88a85ccbdc9b917faf598c38731f10
This commit is contained in:
Nikolay Chashnikov
2022-01-12 16:57:53 +00:00
committed by intellij-monorepo-bot
parent 19dc802c2c
commit 5cb55734be
@@ -251,7 +251,10 @@ class WorkspaceModuleImporter(
private fun addGeneratedJavaSourceFolder(path: String, type: JavaSourceRootType, contentRootEntity: ContentRootEntity) {
if (File(path).list().isNullOrEmpty()) return
val sourceRootEntity = builder.addSourceRootEntity(contentRootEntity, virtualFileUrlManager.fromPath(path),
val url = virtualFileUrlManager.fromPath(path)
if (contentRootEntity.sourceRoots.any { it.url == url }) return
val sourceRootEntity = builder.addSourceRootEntity(contentRootEntity, url,
SourceRootPropertiesHelper.findSerializer(type)?.typeId!!,
contentRootEntity.entitySource)
builder.addJavaSourceRootEntity(sourceRootEntity, true, "")