These are chat archives for sbt/sbt

2nd
Nov 2015
Li Haoyi
@lihaoyi
Nov 02 2015 05:23
I added a .dependsOn(projectA, projectB) to one of my subprojects in build.sbt and it's complaining it can't find those projects on maven central
anyone know how to debug that sort of thing?
It's a
[error] (test/*:update) sbt.ResolveException: unresolved dependency: com.lihaoyi#upickle_2.11;0.3.7-SNAPSHOT: not found
[error] unresolved dependency: com.lihaoyi#pprint_2.11;0.3.7-SNAPSHOT: not found
the build.sbt file looks like
lazy val upickleJS = upickle.js
lazy val upickleJVM = upickle.jvm
lazy val test = project
  .in(file("test"))
  .dependsOn(upickleJVM, pprintJVM)
  .settings(
    scalaVersion := "2.11.7"
  )
(with more stuff above and below defining other subprojects)
I mean of course it's not found in maven, it's a local dependency =<
nafg
@nafg
Nov 02 2015 06:44
@lihaoyi are depended projects also 2.11?
Li Haoyi
@lihaoyi
Nov 02 2015 06:45
ah they're not
they're 2.10.4
that's probably it
nafg
@nafg
Nov 02 2015 06:45
Usually it happens when something like that makes the dependency different than what it expects
Usually because of scala version
Li Haoyi
@lihaoyi
Nov 02 2015 06:46
yeah that must be it
it works now
thanks :D :D :D
Perry
@pfn
Nov 02 2015 06:46
@lihaoyi, cross version error
nafg
@nafg
Nov 02 2015 06:46
I think it's still a bug, the error should be different
Li Haoyi
@lihaoyi
Nov 02 2015 06:46
they're all crossVersioned the same but the default scalaVersion is different
no good reason
i'll just twiddle them to be the same
Perry
@pfn
Nov 02 2015 07:16
@nafg, should. be, but dependsOn is just another ivy dependency, just handled internally
Stefan Larsson
@lastsys
Nov 02 2015 07:39
What type do I need to specify to be able for the Seq to have commonSettings: _* work for key-value pairs where values have several types? The examples I have seen have type Seq[Def.Setting[String]]. If I define keys with other types than strings in the list I get Seq[Object] by default. Apparently I have to replace it with something like Seq[Def.Settings[???]] - what should ??? be?
Dale Wijnand
@dwijnand
Nov 02 2015 12:20
@lastsys: Seq[Setting[_]]
Daniil Sivak
@seroperson
Nov 02 2015 12:23
Guys, there is some hack to filter System.out messages? For example while compiling some library prints debug messages to stdout and I want to suppress they.
Stefan Larsson
@lastsys
Nov 02 2015 12:27
@dwijnand
Does not work. I get this:
 error: type mismatch;
 found   : Seq[sbt.Def.Setting[java.io.File]]
 required: sbt.Setting[_]
    (which expands to)  sbt.Def.Setting[_]
Full expression:
lazy val commonProjectSettings: Seq[Setting[_]] = Seq(
  persistLauncher := true,
  persistLauncher in Test := false,
  libraryDependencies ++= Seq(
    "org.scala-js" %%% "scalajs-dom" % sjsDomVersion,
    "com.github.japgolly.fork.scalaz" %%% "scalaz-core" % sjsScalazVersion,
    "be.doeraene" %%% "scalajs-jquery" % sjsjQueryVersion
  ),
  WebKeys.stagingDirectory := baseDirectory.value / ".." / "target/web/stage",
  Seq(fullOptJS, fastOptJS,
    packageJSDependencies, packageScalaJSLauncher).map(t ⇒
    crossTarget in t := baseDirectory.value / ".." / "target/web/stage/js"
  )
)
Dale Wijnand
@dwijnand
Nov 02 2015 13:27
Try:
lazy val commonProjectSettings: Seq[Setting[_]] = Seq[Setting[_]](
  persistLauncher := true,
  persistLauncher in Test := false,
  libraryDependencies ++= Seq(
    "org.scala-js" %%% "scalajs-dom" % sjsDomVersion,
    "com.github.japgolly.fork.scalaz" %%% "scalaz-core" % sjsScalazVersion,
    "be.doeraene" %%% "scalajs-jquery" % sjsjQueryVersion
  ),
  WebKeys.stagingDirectory := baseDirectory.value / ".." / "target/web/stage"
) ++ Seq(fullOptJS, fastOptJS,
    packageJSDependencies, packageScalaJSLauncher).map(t ⇒
    crossTarget in t := baseDirectory.value / ".." / "target/web/stage/js"
)
Stefan Larsson
@lastsys
Nov 02 2015 13:29
No luck...
error: type mismatch;
 found   : Seq[sbt.Def.Setting[java.io.File]]
 required: sbt.Setting[_]
    (which expands to)  sbt.Def.Setting[_]
    packageJSDependencies, packageScalaJSLauncher).map(t =>
Josh Suereth
@jsuereth
Nov 02 2015 16:20
so you're passing a Seq[Setting[]] to something that wants just a single Setting[]
My theory is that last Seq(fullOpt,....).map
Pull that into its own lazy val xyz: Seq[Setting[_]] = ...
See if you get a better error message there

i.e. what does:

lazy val commonTargetSettings: Seq[Setting[_]] =
Seq(fullOptJS, fastOptJS,
    packageJSDependencies, packageScalaJSLauncher).map(t ⇒
    crossTarget in t := baseDirectory.value / ".." / "target/web/stage/js"
)

Say?

I think you need to help the parser out there, it's a little too loose on the grammer, e.g.
lazy val commonTargetSettings: Seq[Setting[_]] =
Seq(fullOptJS, fastOptJS,
    packageJSDependencies, packageScalaJSLauncher).map(t ⇒
    crossTarget in t := { baseDirectory.value / ".." / "target/web/stage/js" }
)
Sam Halliday
@fommil
Nov 02 2015 16:33
How can I add an unmanaged jar dependency the the meta project?
Josh Suereth
@jsuereth
Nov 02 2015 16:34
project/lib directory isn't working?
Sam Halliday
@fommil
Nov 02 2015 16:37
The file lives somewhere else, network drive.
I'd like to reference it from the plugins.sbt file or the meta project
unmanagedJars gives me an error
Which I can't copy because it's on a different machine
Sam Halliday
@fommil
Nov 02 2015 16:45
I get "reference to undefined setting"
Sam Halliday
@fommil
Nov 02 2015 16:52
Actually if I set up unmanagedJars as a Seq, it doesn't error but my build can't see the jar. Hmm.
Perry
@pfn
Nov 02 2015 16:55
then you added it to the wrong configuration
Sam Halliday
@fommil
Nov 02 2015 16:55
Aha! It needs to be unmanagedJars in Compile
Perry
@pfn
Nov 02 2015 16:55
unmanagedJars in Compile
nafg
@nafg
Nov 02 2015 18:15
@pfn true dependsOn is just an ivy dependency that's resolved internally (i inferrred that from the error message), but it seems wrong to append _2.11 as if I wrote %%, the "ivy artifact id" is whatever the subproject decided, so just like name is taken from it, scalaBinaryVersion should also. Now at that point, sbt should say, hey, you're on 2.11 but you're depending on something (which happens to be your own subproject) that's on a different scala version, that would make sense.
The fact that sbt is guessing it's a _2.11 id is what I meant is a bug IMO
Perry
@pfn
Nov 02 2015 18:18
it absolutely should guess_2.11 though
nafg
@nafg
Nov 02 2015 18:19
@pfn then there's no way it can give a helpful error message
Perry
@pfn
Nov 02 2015 18:20
pretty much
ivy limitations
nafg
@nafg
Nov 02 2015 18:20
Why can't it read the subproject's scalaBinaryVersion?
@pfn I just suggested a better alternative. What do you dislike about it?
My solution will result in the right error message
Perry
@pfn
Nov 02 2015 18:21
the fact it's not doable?
nafg
@nafg
Nov 02 2015 18:28
@pfn Can you elaborate? Why is it not doable?
it's reading the subproject's name, why can't it read its scalaBinaryVersion to form the ivy artifact name?
In other words, the ivy artifact that it's looking for, and the ivy artifact that can be resolved, should be the same
Perry
@pfn
Nov 02 2015 18:40
my guess is if it were doable, it'd be done
I still don't think it works, especially once the artifact is published
Perry
@pfn
Nov 02 2015 18:45
if you do that scheme, resolution will definitely fail after publishing
Li Haoyi
@lihaoyi
Nov 02 2015 19:09
Would there be any interest in making the SBT console trap Ctrl-C and leave you at the console, rather than exiting to Bash?
Having to slowly restart SBT every time I get runnaway code is rather annoying :/
Josh Suereth
@jsuereth
Nov 02 2015 19:09
@lihaoyi it's already there
Li Haoyi
@lihaoyi
Nov 02 2015 19:10
do i need to turn it on somehow?
Josh Suereth
@jsuereth
Nov 02 2015 19:10
you have to use a flag to enable it, because it uses some non-standard JVM hackery
Li Haoyi
@lihaoyi
Nov 02 2015 19:10
what flag
is it documented somewhere?
Josh Suereth
@jsuereth
Nov 02 2015 19:10
I actually forget the flag off the top of my head, but I remember diving through the signal code and fixing it
hmm, one sec
Li Haoyi
@lihaoyi
Nov 02 2015 19:10
I thought you could just catch the ThreadDeath exception at your command-line handler
oh i guess you need to do signals you're right
Josh Suereth
@jsuereth
Nov 02 2015 19:12
set cancelable in Global := true
Li Haoyi
@lihaoyi
Nov 02 2015 19:13
omg
this is amazing
Josh Suereth
@jsuereth
Nov 02 2015 19:28
Maybe we should just turn it on by default and document what happens if you get the ever-so-rare "HOLY KRAP WHAT ARE DOING THIS IS NOT ORACLE JDK" exception
Dan Di Spaltro
@dispalt
Nov 02 2015 19:30
in a build.scala file where would I put that?
Josh Suereth
@jsuereth
Nov 02 2015 19:33
@ddispaltro Anywhere that has a setttings(<here>)
Dan Di Spaltro
@dispalt
Nov 02 2015 19:34
yeah so if I put it on some shared settings that all projects inherit or I put it on the root only, it wouldn’t matter, right?
Josh Suereth
@jsuereth
Nov 02 2015 19:53
nope
def globalSettings = super.globalSettings ++ Seq(<here>) may be the right spot
I think, but .scala files are deprecated eventually....
Li Haoyi
@lihaoyi
Nov 02 2015 20:38
@jsuereth no need to even throw an exception, just fall back to the "exit process lolz" behavior
won't be any worse than it is now
if I want Ctrl-C at the command-line to not exit, but just clear the line, should I open an issue?
Perry
@pfn
Nov 02 2015 21:05
@jsuereth I use icedtea on linux, not rare..
and I'm on windows the rest of the time
Eric K Richardson
@ekrich
Nov 02 2015 22:56

C:\Users\erichardson\workspaces\rogers\smartgwt-example>sbt reboot full [info] Loading project definition from C:\Users\erichardson\workspaces\rogers\smartgwt-example\project C:\Users\erichardson\workspaces\rogers\smartgwt-example\build.sbt:81: error: reference to packageWar is ambiguous; it is imported twice in the same scope by import _root_.com.earldouglas.xsbtwebplugin.PluginKeys._ and import $50c6c8322457f4f6a889._ packageWar := { ^ [error] Type error in expression

I commented out the xsbt-web-plugin in plugins.sbt but don't know how to clean things out - suggestions?