Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing setting: ensimeScalacTransformer error in sbt ensimeConfig #1425

Open
lightwave opened this issue Jul 4, 2018 · 7 comments
Open
Labels

Comments

@lightwave
Copy link

Lagom Version (1.2.x / 1.3.x / etc)

1.4.6

API (Scala / Java / Neither / Both)

scala

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

MacOS 10.13.5

JDK (Oracle 1.8.0_112, OpenJDK 1.8.x, Azul Zing)

java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)

Library Dependencies

If this is an issue that involves integration with another system, include the exact version and OS of the other system, including any intermediate drivers or APIs i.e. if you connect to a PostgreSQL database, include both the version / OS of PostgreSQL and the JDBC driver version used to connect to the database.

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Assume you have the following in ~/.sbt/1.0/plugins/plugins.sbt
addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")
  1. Change scala version in build.sbt to 2.12.6
  2. Change sbt version in project/build.properties to 1.1.6
  3. sbt
  4. In sbt, execute the compile task
  5. In sbt, execute the ensimeConfig task

ensimeConfig should produce .ensime file successfully without any error.

Actual Behavior

  1. Assume you have the following in ~/.sbt/1.0/plugins/plugins.sbt
addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")
  1. Change scala version in build.sbt to 2.12.6
  2. Change sbt version in project/build.properties to 1.1.6
  3. sbt
  4. In sbt, execute the compile task
  5. In sbt, execute the ensimeConfig task

You will see the following errors.

[info] Loading settings from plugins.sbt ...
[info] Loading global plugins from /Users/chris/.sbt/1.0/plugins
[info] Loading settings from plugins.sbt ...
[info] Loading project definition from /Users/chris/git/scala/lagom/shoppingcart/project
[info] Loading settings from build.sbt ...
[info] Set current project to shoppingcart (in build file:/Users/chris/git/scala/lagom/shoppingcart/)
[info] sbt server started at local:///Users/chris/.sbt/1.0/server/9b3bd04c48c6a8a4a8c2/sock
sbt:shoppingcart> compile
[success] Total time: 1 s, completed Jul 4, 2018 10:31:36 AM
sbt:shoppingcart> ensimeConfig
[info] ENSIME update.
[info] ENSIME processing shoppingcart-api (shoppingcart-api)
[info] ENSIME processing lagom-internal-meta-project-cassandra (lagom-internal-meta-project-cassandra)
[error] Missing setting: ensimeScalacTransformer
[error] java.lang.IllegalArgumentException
[error] 	at org.ensime.CommandSupport$.org$ensime$CommandSupport$$fail(EnsimePlugin.scala:819)
[error] 	at org.ensime.CommandSupport$RichSettingKey.$anonfun$gimme$1(EnsimePlugin.scala:827)
[error] 	at scala.Option.getOrElse(Option.scala:121)
[error] 	at org.ensime.CommandSupport$RichSettingKey.gimme(EnsimePlugin.scala:827)
[error] 	at org.ensime.EnsimePlugin$.configDataFor$1(EnsimePlugin.scala:517)
[error] 	at org.ensime.EnsimePlugin$.$anonfun$projectData$17(EnsimePlugin.scala:576)
[error] 	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:234)
[error] 	at scala.collection.immutable.Set$Set2.foreach(Set.scala:130)
[error] 	at scala.collection.TraversableLike.map(TraversableLike.scala:234)
[error] 	at scala.collection.TraversableLike.map$(TraversableLike.scala:227)
[error] 	at scala.collection.AbstractSet.scala$collection$SetLike$$super$map(Set.scala:47)
[error] 	at scala.collection.SetLike.map(SetLike.scala:101)
[error] 	at scala.collection.SetLike.map$(SetLike.scala:101)
[error] 	at scala.collection.AbstractSet.map(Set.scala:47)
[error] 	at org.ensime.EnsimePlugin$.projectData(EnsimePlugin.scala:576)
[error] 	at org.ensime.EnsimePlugin$.$anonfun$ensimeConfigTaskImpl$14(EnsimePlugin.scala:368)
[error] 	at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)
[error] 	at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:231)
[error] 	at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:462)
[error] 	at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:462)
[error] 	at scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)
[error] 	at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)
[error] 	at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
[error] 	at org.ensime.EnsimePlugin$.$anonfun$ensimeConfigTaskImpl$5(EnsimePlugin.scala:365)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:263)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:272)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:263)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (ensimeConfigTask) java.lang.IllegalArgumentException
[error] Total time: 11 s, completed Jul 4, 2018 10:31:50 AM
sbt:shoppingcart> [info] shutting down server

Reproducible Test Case

  1. sbt new lagom/lagom-scala.g8
  2. Use ShoppingCart as the project name, for the rest, just use the default
  3. Make sure you have the following in ~/.sbt/1.0/plugins/plugins.sbt
addSbtPlugin("org.ensime" % "sbt-ensime" % "2.6.1")
  1. Change scala version in build.sbt to 2.12.6
  2. Change sbt version in project/build.properties to 1.1.6
  3. Start sbt
  4. In sbt, execute the compile task
  5. In sbt, execute the ensimeConfig task
@TimMoore TimMoore added type:defect help wanted Ready and waiting for a volunteer topic:dev-environment labels Aug 13, 2018
@TimMoore
Copy link
Contributor

I think we'll need an Ensime user to contribute a fix for this. If anyone would like to volunteer to fix (or even to verify whether it's still an issue in the latest versions of Ensime and Lagom) please comment here.

@lightwave
Copy link
Author

@guillegr123 filed same issue ensime/ensime-sbt#401 but ensime volunteers feel that Lightbend should fix it... 😓

@lightwave
Copy link
Author

@TimMoore Can you help me understand more about the Lagom SBT build? I'm trying to contribute to fixing this compatibility issue between Lagom and Ensime.

From my understanding, Lagom's SBT plugin generated some dynamic projects in target/lagom-dynamic-projects/ directory. This is where ensime-sbt plugin chokes. When ensimeConfig started processing shoppingcart-api subproject, it descends to process target/lagom-dynamic-projects/lagom-internal-meta-project-cassandra. However, this lagom-internal-meta-project-cassandra subproject doesn't have the ensime sbt plugin injected for some reason, and it can't process to do ensimeConfig at this subproject level.

The way Lagom's SBT do the build is quite unconventional. Can you enlighten me on why it's done this way inside the target directory (which may or may not be a contributing factor to this problem.)?

I don't know enough about SBT... do you have any idea why target/lagom-dynamic-projects don't pick up the ensime-sbt plugin? Is it because they are not sbt subprojects? (I don't see any build.sbt file in those directories.) If these are just dynamically generated source files, why not put them under ./lib which sbt will properly recognize as unmanaged source file by default?

@TimMoore
Copy link
Contributor

Thanks for looking at it, @lightwave!

This part of Lagom was developed by other people before I joined the project, so you probably understand it about as well as I do at this point. I believe the reason it uses dynamic projects is to be able to leverage sbt to manage the classpath and execution.

The code that implements it is here:

The comment says:

     * The projects should define all their settings (note, autoplugins will not be applied here, the project should
     * manually add all settings it needs, including things from the CorePlugin, IvyPlugin etc).  They also will most
     * likely need to pass a non nil set of configurations.

I think the problem is likely related to that.

@vgordievskiy
Copy link

HI all, I have found solution in: https://github.com/ensime/ensime-sbt/issues/401#issuecomment-425631407

It works for me.

@TimMoore
Copy link
Contributor

Nice, thanks for the pointer @vgordievskiy. Do you know if there's anything that could be changed in Lagom that would make this automatic, but without creating a dependency on Ensime?

@vgordievskiy
Copy link

I don't know. I am new with the Lagom project (2 day). I just have tried to run it (with ensime for VSCode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants