Build fails for servlet-web-applicatione example in Intellij 16 EAP

Hi All,

I was just trying to build the servlet-web-application gradle project in intellij using Build → Rebuild project and it fails with following error.

Error:Kotlin: [Internal Error] java.lang.IllegalArgumentException: Target is expected to have output directory: Module ‘servlet_web_applications_test’ production
at org.jetbrains.kotlin.jps.incremental.IncrementalCacheImpl.(IncrementalCacheImpl.kt:819)
at org.jetbrains.kotlin.jps.incremental.KotlinIncrementalStorageProvider.createStorage(IncrementalCacheImpl.kt:742)
at org.jetbrains.kotlin.jps.incremental.KotlinIncrementalStorageProvider.createStorage(IncrementalCacheImpl.kt:732)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages$1.compute(BuildTargetStorages.java:56)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages$1.compute(BuildTargetStorages.java:51)
at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:40)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages.getOrCreateStorage(BuildTargetStorages.java:70)
at org.jetbrains.jps.incremental.storage.BuildDataManager.getStorage(BuildDataManager.java:154)
at org.jetbrains.kotlin.jps.incremental.IncrementalCacheImplKt.getKotlinCache(IncrementalCacheImpl.kt:746)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt$getIncrementalCaches$caches$1.invoke(KotlinBuilder.kt:789)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt$getIncrementalCaches$caches$1.invoke(KotlinBuilder.kt)
at org.jetbrains.kotlin.utils.CollectionsKt.keysToMap(collections.kt:62)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt.getIncrementalCaches(KotlinBuilder.kt:789)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt.access$getIncrementalCaches(KotlinBuilder.kt:1)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.doBuild(KotlinBuilder.kt:189)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.build(KotlinBuilder.kt:131)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1230)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:904)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:976)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:870)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:695)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:386)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:193)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:294)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1158)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:632)
at java.lang.Thread.run(Thread.java:747)

No changes have been made to the project available in github.

Project can be build successfully in command line with ‘gradle war’ but just fails to build from IDE.

Bug with kotlin gradle plugin or Intellij EAP?

Fix will be available soon. Temporary You can use IDEA 15 instead.

1 Like

I’m experiencing a similar issue as well. This happens only after I install the Kotlin plugin.

Error:Kotlin: [Internal Error] java.lang.IllegalArgumentException: Target is expected to have output directory: Module ‘algs4_test’ production
at org.jetbrains.kotlin.jps.incremental.IncrementalCacheImpl.(IncrementalCacheImpl.kt:819)
at org.jetbrains.kotlin.jps.incremental.KotlinIncrementalStorageProvider.createStorage(IncrementalCacheImpl.kt:742)
at org.jetbrains.kotlin.jps.incremental.KotlinIncrementalStorageProvider.createStorage(IncrementalCacheImpl.kt:732)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages$1.compute(BuildTargetStorages.java:56)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages$1.compute(BuildTargetStorages.java:51)
at com.intellij.openapi.util.AtomicNotNullLazyValue.getValue(AtomicNotNullLazyValue.java:40)
at org.jetbrains.jps.builders.impl.storage.BuildTargetStorages.getOrCreateStorage(BuildTargetStorages.java:70)
at org.jetbrains.jps.incremental.storage.BuildDataManager.getStorage(BuildDataManager.java:154)
at org.jetbrains.kotlin.jps.incremental.IncrementalCacheImplKt.getKotlinCache(IncrementalCacheImpl.kt:746)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt$getIncrementalCaches$caches$1.invoke(KotlinBuilder.kt:789)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt$getIncrementalCaches$caches$1.invoke(KotlinBuilder.kt)
at org.jetbrains.kotlin.utils.CollectionsKt.keysToMap(collections.kt:62)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt.getIncrementalCaches(KotlinBuilder.kt:789)
at org.jetbrains.kotlin.jps.build.KotlinBuilderKt.access$getIncrementalCaches(KotlinBuilder.kt:1)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.doBuild(KotlinBuilder.kt:189)
at org.jetbrains.kotlin.jps.build.KotlinBuilder.build(KotlinBuilder.kt:131)
at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1230)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:904)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:976)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:870)
at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:695)
at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:386)
at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:193)
at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:294)
at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:232)
at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

What version of Intellij and Java are you using?

It seems Kotlin does not work with Intellij 16 EAP and Java 9 EA

Yes, it’s similar case and as I said fix will be available soon.

I’m using IntelliJ 16 EAP and Java 8.

Ok, thanks.

I have the same issue here. I use the following workaround:

Go to “Module settings” → Paths

Set “Compiler output” to “Inherit project compile output path”

Update available now, try to update plugin.