Output path is shared between the same module error

When I try to compile any class in my project I get the error below:

Error scala: Output path .../eval/target/test-classes is shared between: Module 'eval' tests, Module 'eval' tests
      Output path .../eval/target/classes is shared between: Module 'eval' production, Module 'eval' production
      Please configure separate output paths to proceed with the compilation.

I've seen how to set the output path in IDEA and I've done it. But as the error claims that it is shared between the same module I couldn't solve it.

Obs.: Using Maven and IntelliJ IDEA.

Please, can anyone help?


all you need to do is:

  • synchronize both modules (right click > Synchronize)
  • re-import pom.xml for both modules (right click > Maven > Re Import)


Set up the output paths for your modules to different directories, as explained here: https://www.jetbrains.com/idea/help/configuring-module-compiler-output.html

On Project "Open Module Settings" -> Modules -> Paths -> Output/Test path

I resolved this by selecting "Inherit project compile output path" in the Project Structure settings window.

  1. Files --> Invalidate caches and restart
  2. Close intellij
  3. delete (extenrally from intellij) .idea folder (backup runConfigurations folder if you have one).
  4. delete the project.iml file
  5. Open intellij
  6. Open the project again from pom or from sbt (or whatever source build tool you have.

I had this happen with the root module in a multi-module project. Since the root module was just a placeholder, it didn't actually contain any code, but IDEA still complained that it was sharing an output path ([project]/build) between test and production.

The fix was to add

plugins {
  id "java"

at the top of the root build.gradle file (applying the otherwise unnecessary Java plugin) and reimporting the project. This allowed IDEA to pick up the Java-default [project]/build/classes/main and [project]/build/classes/test output directories.

Open up the module settings and look for errors. Fix said errors and everything should work.

Problem solved!

I have reset backward and forward my git repository many times and close-reopen idea after some of it. When finaly IDEA shows a red message at the right top while it was starting. It says something like: the project has already a eval module, and if I want to delete eval module. Yes, it was quite confusing, but I click on delete and my problem disappear. I guess that for some reason I become with 2 eval modules and it delete one of it solving output path error.

For a Spark project, the IDE created _2.11 versions of SBT modules. I had to delete them by hand.

enter image description here

Idea itself reports an error, the prompt is already very obvious, calm analysis can solve; Open Project Structure --> modules. Delete or reconfigure outputPath,The computer is the most honest

This is really a response to @habitat's comment on @Corey Klein 's answer. If someone with enough reputation wants to edit, please go ahead...

I had the same problem with the setting being reset every time I refreshed the project. My solution (with Gradle, although I'm guessing there is an equivalent Maven plugin) was to add

apply plugin: 'idea'
idea {
    module {
        inheritOutputDirs = true

For gradle, I delete the .idea folder and reopen the project. Everything is recovery.

I face the same issue i resolve this by deleting .iml2 from the module which was created by intellij.

Need Your Help

Sharepoint popup login windows

sharepoint login popup

After I log into my sharepoint website, I have to login everytime I access a document from the library. Is there a way to fix this?

stackoverflow when serializing hashmap in snakeyaml

java stack-overflow snakeyaml

i tried to serialize a class containing a hashmap with snakeYAML 1.13 and just got a pretty weird stackoverflow: