diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt
index 7876183922e..e60bc8b2e05 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt
@@ -330,7 +330,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
.filter { it.isKotlinPlugin() }
.flatMap { it.executions.asSequence() }
.flatMap { it.goals.asSequence() }
- .any { it !in PomFile.KotlinGoals.JvmGoals }
+ .any { it in PomFile.KotlinGoals.CompileGoals && it !in PomFile.KotlinGoals.JvmGoals }
val prodSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) KotlinSourceRootType.Source else JavaSourceRootType.SOURCE
val testSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) KotlinSourceRootType.TestSource else JavaSourceRootType.TEST_SOURCE
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt.173 b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt.173
index 56182cc8dbb..f4bba6dbc65 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt.173
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/KotlinMavenImporter.kt.173
@@ -332,7 +332,7 @@ class KotlinMavenImporter : MavenImporter(KOTLIN_PLUGIN_GROUP_ID, KOTLIN_PLUGIN_
.filter { it.isKotlinPlugin() }
.flatMap { it.executions.asSequence() }
.flatMap { it.goals.asSequence() }
- .any { it !in PomFile.KotlinGoals.JvmGoals }
+ .any { it in PomFile.KotlinGoals.CompileGoals && it !in PomFile.KotlinGoals.JvmGoals }
val prodSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) KotlinSourceRootType.Source else JavaSourceRootType.SOURCE
val testSourceRootType: JpsModuleSourceRootType<*> = if (isNonJvmModule) KotlinSourceRootType.TestSource else JavaSourceRootType.TEST_SOURCE
diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt
index 346d80c11fe..6f1124f0a32 100644
--- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt
+++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/PomFile.kt
@@ -547,11 +547,13 @@ class PomFile private constructor(private val xmlFile: XmlFile, val domModel: Ma
object KotlinGoals {
const val Compile = "compile"
const val TestCompile = "test-compile"
+
const val Js = "js"
const val TestJs = "test-js"
const val MetaData = "metadata"
val JvmGoals = listOf(Compile, TestCompile)
+ val CompileGoals = listOf(Compile, TestCompile, Js, TestJs, MetaData)
}
companion object {
diff --git a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
index 73bf1396d44..f5d2b4e7605 100644
--- a/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
+++ b/idea/idea-maven/test/org/jetbrains/kotlin/idea/maven/KotlinMavenImporterTest.kt
@@ -175,6 +175,98 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
assertTestSources("project", "src/test/java", "src/test/kotlin", "src/test/kotlin.jvm")
}
+ fun testWithKapt() {
+ createProjectSubDirs("src/main/kotlin", "src/main/kotlin.jvm", "src/test/kotlin", "src/test/kotlin.jvm")
+
+ importProject(
+ """
+ test
+ project
+ 1.0.0
+
+
+
+ org.jetbrains.kotlin
+ kotlin-stdlib
+ $kotlinVersion
+
+
+
+
+
+
+ org.jetbrains.kotlin
+ kotlin-maven-plugin
+
+
+
+ kapt
+
+ kapt
+
+
+
+ src/main/kotlin
+ src/main/java
+
+
+
+
+
+ compile
+ compile
+
+ compile
+
+
+
+ src/main/kotlin
+ src/main/java
+
+
+
+
+
+ test-kapt
+
+ test-kapt
+
+
+
+ src/test/kotlin
+ src/test/java
+
+
+
+
+
+ test-compile
+ test-compile
+
+ test-compile
+
+
+
+ src/test/kotlin
+ src/test/java
+ target/generated-sources/kapt/test
+
+
+
+
+
+
+
+ """
+ )
+
+ assertModules("project")
+ assertImporterStatePresent()
+
+ assertSources("project", "src/main/java", "src/main/kotlin")
+ assertTestSources("project", "src/test/java", "src/test/kotlin")
+ }
+
fun testReImportRemoveDir() {
createProjectSubDirs("src/main/kotlin", "src/main/kotlin.jvm", "src/test/kotlin", "src/test/kotlin.jvm")