我sbt
在Intelli-j 13.1中使用以下项目结构
.
├── build.sbt
├── project
│ ├── Build.scala
│ ├── plugins.sbt
├── src
│ ├── main
│ └── test
└── target
我的built.sbt
方法很简单,我只声明一些依赖项。
我project/Build.scala
的有点复杂,它使用以下方法定义了一个新项目:
惰性val RiepeteKernel = Project(id =“ riepete-kernel”,base = file(“。”),设置= defaultSettings)
Intellij似乎不喜欢它。它在项目设置中设置了两个附加模块,如下所示:
当我尝试编译项目时,出现以下错误:
Error:scalac: Output path /home/simao/code/riepete/project/target/idea-test-classes is shared between:
Module 'riepete-build' tests, Module 'riepete-kernel-build' tests Output path /home/simao/code/riepete/project/target/idea-classes
is shared between: Module 'riepete-build' production,
Module 'riepete-kernel-build' production Please configure separate output
paths to proceed with the compilation.
TIP: you can use Project Artifacts to combine compiled classes if needed.
Since I just need my extra project to run sbt dist
on the console, if I delete the two additional modules that intellij creates everything works, but I need to do this every time I restart intellij.
Is there a way to make intellij not create these two additional modules?
Thank you
It depends on you version of sbt
but at least in version 0.13.x
you can use project
macro like this:
lazy val riepete = project.in( file(".") )
This way IntelliJ idea won't create an additional module.
You can even put this is your build.sbt
. According to my experience in most cases you can just maintain a simple build.sbt
file, especially with latest versions of sbt
. Anyway I guess keeping it in one place makes sense: build.sbt
or Build.scala
in project
folder.
如果您的项目或子项目文件夹名称包含-
或其他字符,则可以始终使用反勾号,例如:
lazy val `riepete-project` = project
在这种情况下,您甚至不需要使用.in(file(....
宏,因为宏将根据模块的名称从正确的文件夹中选择文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句