“Cannot start compilation: the output path is not specified for module…”

后端 未结 12 2369
忘掉有多难
忘掉有多难 2020-12-13 08:43

I have a very simple Java + Gradle project. It builds fine. It runs fine from the shell with \"gradle run\". However, if I try to run inside of IntelliJ, I get:



        
相关标签:
12条回答
  • 2020-12-13 08:55

    If none of the above method worked then try this it worked for me.

    Go to File > Project Structure> Project and then in Project Compiler Output click on the three dots and provide the path of your project name(name of the file) and then click on Apply and than on Ok.

    It should be like that as in the picture i an posting.

    0 讨论(0)
  • 2020-12-13 08:55

    Open .iml file. Look for keyword 'NewModuleRootManager'. Check if attribute 'inherit-compiler-output' is set to true or not. If not set to true.

    Like this :

    component name="NewModuleRootManager" inherit-compiler-output="true">
        <content url="file://$MODULE_DIR$">
          <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
          <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
          <sourceFolder url="file://$MODULE_DIR$/app" isTestSource="false" />
    
    0 讨论(0)
  • 2020-12-13 08:55

    After this

    Two things to do:

    Project Settings > Project compiler output > Set it as "Project path(You actual project's path)”+”\out”.

    Project Settings > Module > Path > Choose "Inherit project compile path""

    If button ran is not active

    You must reload IDEA

    0 讨论(0)
  • 2020-12-13 08:58

    None of the suggestions worked for me until I ran the command "gradle cleanIdeaModule ideaModule" info here: https://docs.gradle.org/current/userguide/idea_plugin.html

    0 讨论(0)
  • 2020-12-13 09:03

    You have to define a path in the "Project compiler output" field in

    File > Project Structure... > Project > Project compiler output

    This path will be used to store all project compilation results.

    0 讨论(0)
  • 2020-12-13 09:03

    While configuring idea plugin in gradle, you should define output directories as follows.

    idea{
        module{
            inheritOutputDirs = false
            outputDir = compileJava.destinationDir
            testOutputDir = compileTestJava.destinationDir
        }
    }
    
    0 讨论(0)
提交回复
热议问题