创建ensime config

时间:2018-06-18 01:29:52

标签: scala sbt ensime

我正在尝试使用ensime-sbt插件在Lagom 1.4.4项目上创建ensime配置文件。但是,当在项目的根目录上运行ensimeConfig命令时,我收到此错误:

> ensimeConfig [info] ENSIME update.
[info] Resolving com.lightbend.lagom#lagom-reloadable-server_2.12;1.4.4 ... 
[info] ENSIME processing lagom-internal-meta-project-service-locator (lagom-internal-meta-project-service-locator)
[error] Missing setting: ensimeScalacTransformer
[trace] Stack trace suppressed: run last my-project/*:ensimeConfig for the full output.
[error] (my-project/*:ensimeConfig) java.lang.IllegalArgumentException 
[error] Total time: 56 s, completed Jun 12, 2018 7:37:12 PM

似乎项目lagom-internal-meta-project-service-locator是由构建的Lagom插件动态创建的,因为它位于 target / lagom-dynamic-projects 下。此外,似乎不需要编码。所以我最好的方法是忽略文件夹 target / lagom-dynamic-projects 下的所有项目。

运行ensimeConfig时如何忽略文件夹下的所有项目?

2 个答案:

答案 0 :(得分:0)

Lagom和ensime不顺利,但您可以尝试将其添加到您的sbt文件中:

lazy val serviceLocatorProject = ProjectRef(uri("."), "lagom-internal-meta-project-service-locator")
ensimeUnmanagedSourceArchives in serviceLocatorProject := Nil
ensimeUnmanagedJavadocArchives in serviceLocatorProject := Nil

您可能需要为lagom-internal-meta-project-cassandralagom-internal-meta-project-kafka等任何其他内部连接器执行此操作。

答案 1 :(得分:0)

Hüseyin建议的解决方案是一个起点,但并未完全解决问题。通过将它添加到我的build.sbt中(如果不想直接在项目中将它添加到$ HOME / .sbt / 1.0 / global.sbt中,则可以使我与Lagom一起使用)。

import org.ensime.EnsimeKeys._
import org.ensime.EnsimePlugin

ensimeIgnoreMissingDirectories := true

ensimeIgnoreScalaMismatch in ThisBuild := true
ensimeScalaVersion in ThisBuild := "2.12.6"

lazy val serviceLocatorProject = ProjectRef(uri("."), "lagom-internal-meta-   project-service-locator")
ensimeUnmanagedSourceArchives in serviceLocatorProject := Nil
ensimeUnmanagedJavadocArchives in serviceLocatorProject := Nil
ensimeScalacTransformer in serviceLocatorProject := identity
ensimeScalacOptions in serviceLocatorProject := EnsimePlugin.ensimeSuggestedScalacOptions(scalaVersion.value)
ensimeJavacOptions in serviceLocatorProject := Nil

lazy val cassandraProject = ProjectRef(uri("."), "lagom-internal-meta-project-cassandra")
ensimeUnmanagedSourceArchives in cassandraProject := Nil
ensimeUnmanagedJavadocArchives in cassandraProject := Nil
ensimeScalacTransformer in cassandraProject := identity
ensimeScalacOptions in cassandraProject := EnsimePlugin.ensimeSuggestedScalacOptions(scalaVersion.value)
ensimeJavacOptions in cassandraProject := Nil

lazy val kafkaProject = ProjectRef(uri("."), "lagom-internal-meta-project-kafka")
ensimeUnmanagedSourceArchives in kafkaProject := Nil
ensimeUnmanagedJavadocArchives in kafkaProject := Nil
ensimeScalacTransformer in kafkaProject := identity
ensimeScalacOptions in kafkaProject := EnsimePlugin.ensimeSuggestedScalacOptions(scalaVersion.value)
ensimeJavacOptions in kafkaProject := Nil