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

"Unable to find scalahost compiler plugin jar" error if remove explicit root project #200

Closed
xuwei-k opened this issue Jun 8, 2017 · 3 comments

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented Jun 8, 2017

step

xuwei-k@a18c180

remove explicit root project from scalafix-sbt/src/sbt-test/sbt-scalafix/cross-build/build.sbt and then test

--- a/scalafix-sbt/src/sbt-test/sbt-scalafix/cross-build/build.sbt
+++ b/scalafix-sbt/src/sbt-test/sbt-scalafix/cross-build/build.sbt
@@ -1,12 +1,4 @@
 updateOptions in ThisBuild := updateOptions.value.withLatestSnapshots(false)
-lazy val root = project
-  .in(file("."))
-  .aggregate(
-    customSourceroot,
-    scala211,
-    scala210,
-    scala212
-  )
 
 lazy val scala210 = project.settings(scalaVersion := "2.10.5")

problem

https://travis-ci.org/xuwei-k/scalafix/jobs/240723037#L2395

[info] java.lang.IllegalStateException: Unable to find scalahost compiler plugin jar.
[info] Please report the output below at https://github.com/scalameta/scalameta/issues
[info] Scala version: 2.12.2
[info] Cross version: List(2.12.2)
[info] Jar regex: .*scalahost_2.12.2(-1.8.0)?.jar$
[info] All jars: ArraySeq()
[info] 
[info] 	at scala.meta.scalahost.sbt.ScalahostSbtPlugin$$anonfun$scalahostJarPath$1$$anonfun$3.apply(ScalahostSbtPlugin.scala:151)
[info] 	at scala.meta.scalahost.sbt.ScalahostSbtPlugin$$anonfun$scalahostJarPath$1$$anonfun$3.apply(ScalahostSbtPlugin.scala:151)
[info] 	at scala.Option.getOrElse(Option.scala:120)
[info] 	at scala.meta.scalahost.sbt.ScalahostSbtPlugin$$anonfun$scalahostJarPath$1.apply(ScalahostSbtPlugin.scala:150)
[info] 	at scala.meta.scalahost.sbt.ScalahostSbtPlugin$$anonfun$scalahostJarPath$1.apply(ScalahostSbtPlugin.scala:141)
[info] 	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[info] 	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
[info] 	at sbt.std.Transform$$anon$4.work(System.scala:63)
[info] 	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
[info] 	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
[info] 	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[info] 	at sbt.Execute.work(Execute.scala:237)
[info] 	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
[info] 	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
[info] 	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
[info] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
[info] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[info] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[info] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[info] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[info] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[info] 	at java.lang.Thread.run(Thread.java:745)
[info] [error] (scalafix-stub/*:scalacOptions) java.lang.IllegalStateException: Unable to find scalahost compiler plugin jar.
[info] [error] Please report the output below at https://github.com/scalameta/scalameta/issues
[info] [error] Scala version: 2.12.2
[info] [error] Cross version: List(2.12.2)
[info] [error] Jar regex: .*scalahost_2.12.2(-1.8.0)?.jar$
[info] [error] All jars: ArraySeq()
[info] [error] Total time: 15 s, completed Jun 8, 2017 10:04:14 AM
[error] x sbt-scalafix / cross-build
[error]    {line 2}  Command failed: compile failed
java.lang.RuntimeException: Failed tests:
	sbt-scalafix / cross-build

edit: I'm not sure this is scalafix issue or scalameta issue.

@olafurpg
Copy link
Contributor

olafurpg commented Jun 8, 2017

Thank you for reporting! This is not great at all. I will investigate.

olafurpg added a commit to olafurpg/scalafix that referenced this issue Jun 8, 2017
This error was caused by a bad interplay between sbt-scalahost and
sbt-scalafix.
- sbt-scalahost inject stuff into scalacOptions and libraryDependencies.
  In scalacOptions, we call update.value, which relies on dependencies
  in libraryDependencies.
- sbt-scalafix creates a a synthetic project "scalafix-stub" to fetch
  jars for scalafix-cli and sets the libraryDependencies to empty list
  but leaves scalacOptions unchanged. scalafix-stub/compile
  triggers scalafix-stub/scalacOptions which triggers
  update.value in sbt-scalahost.

This commit sets scalacOptions of scalafix-sbt to empty list, avoiding
the failed dependency resolution caused by sbt-scalahost.
olafurpg added a commit to olafurpg/scalafix that referenced this issue Jun 8, 2017
This error was caused by a bad interplay between sbt-scalahost and
sbt-scalafix.
- sbt-scalahost injects stuff into both scalacOptions and
  libraryDependencies.  In scalacOptions, we call update.value, which
  relies on the existence of dependencies in libraryDependencies.
- sbt-scalafix creates a a synthetic project "scalafix-stub" to fetch
  jars for scalafix-cli and sets the libraryDependencies to empty list
  but leaves scalacOptions unchanged. scalafix-stub/compile
  triggers scalafix-stub/scalacOptions which triggers
  update.value to return an empty list.

This commit sets scalacOptions of scalafix-sbt to empty list, overriding
the injected scalacOptions by sbt-scalahost.
@olafurpg
Copy link
Contributor

olafurpg commented Jun 8, 2017

I was able to reproduce and tracked the root cause to an unexpected interplay between sbt-scalahost and sbt-scalafix (both plugins written by myself 😅 ). Fix pending in #202, I'll try to cut a release asap.

I really wish sbt made it easier to fetch jars for outside of projects, see sbt/sbt#2879.

olafurpg added a commit that referenced this issue Jun 8, 2017
Fix #200, override injected scalacOptions.
@olafurpg
Copy link
Contributor

olafurpg commented Jun 8, 2017

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

No branches or pull requests

2 participants