How to stop Intellij from creating src/main/java and src/main/scala-x folders?

会有一股神秘感。 提交于 2019-12-21 07:08:58

问题


I have a SBT project in Intellij 15.0.2 for scala only programming.

For some reason, the project keeps creating the following folders in my project:

  • src/main/java
  • src/main/scala-2.10
  • src/main/scala-2.11
  • src/test/java
  • src/test/scala-2.10
  • src/test/scala-2.11

I have attempted to remove them by unchecking them as "Sources" or "Tests" in my Project Structure and then deleting the folders. But they are immediately re-created by Intellij ...


回答1:


You can disable this while creating/importing sbt project (there is a suitable checkbox).

If project is already created, you can go to

Settings |> Build, Execution, Deployment |> Build Tools |> SBT

and uncheck Create directores for empty content roots automatically

This option is kind of usefull if you are starting a new project as it will create directories for you, but after this I suggest to disable this option and keep only directories you want, otherways directories will be generated each time you build/refresh project.

See picture:

Edit

Seems like this option disappeared from Idea interface. If you have an old project and it is enabled there, go to .idea/sbt.xml and get rid of

<option name="createEmptyContentRootDirectories" value="true" />


来源:https://stackoverflow.com/questions/35876995/how-to-stop-intellij-from-creating-src-main-java-and-src-main-scala-x-folders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!