These are chat archives for sbt/sbt

14th
Oct 2015
Pathikrit Bhowmick
@pathikrit
Oct 14 2015 06:18

i am trying a multi-project build for one of my projects. Here is my build.sbt: https://github.com/pathikrit/better-files/blob/mavenize/build.sbt
but my build is failing (I tried clean) with a strange runtime error: https://circleci.com/gh/pathikrit/better-files/299 (java.lang.NoSuchMethodError)

How is this possible??

Pathikrit Bhowmick
@pathikrit
Oct 14 2015 06:48
Pathikrit Bhowmick
@pathikrit
Oct 14 2015 07:26
here is my branch: https://github.com/pathikrit/better-files/find/mavenize - no funny directory structure or project setup, but sbt still fails during run-time :(
Elmar
@elm-
Oct 14 2015 07:48
Hi guys, I'm having a problem with recompilation and am a bit stuck on how to debug it and on stackoverflow there is no help so far (http://stackoverflow.com/questions/32787282/sbt-needs-several-recompiles-finds-allways-more-changes). in short: sbt does not recognize the correct changes and dependencies for recompiles, I can sometimes call compile 20 times and it still recompiles always different files. Upgrade to latest version, clean, new checkout, etc. are without result. Problem persists across OS and computers, although not reliable reproducible. Is there any way to get more details on the incremental compilation, e.g. why it takes certain files?
Martin Duhem
@Duhemm
Oct 14 2015 07:55
Try running last, it will show you the debug log and tell you what file have been invalidated and why:
[debug] Initial source changes:
[debug]     removed:Set()
[debug]     added: Set()
[debug]     modified: Set(/foo/bar/baz.scala)
[debug] Invalidated products: Set()
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set(/foo/bar/baz.scala)
In your case it looks like the files are directly invalidated because sbt considers that they are modified, so this may not be very interesting
Are you sure that you do not have some process that randomly touches some of your files?
Martin Duhem
@Duhemm
Oct 14 2015 08:02
IIRC the incremental compiler will recompute the hashsums of all source files to determine whether they have been modified, so touch would not trigger recompilation
Pathikrit Bhowmick
@pathikrit
Oct 14 2015 08:04
huh apprently if you have multi-modules and have each module has a package.scala under foo.bar - code compiles but we get java.lang.NoSuchMethodError during runtime. what am i missing?
Martin Duhem
@Duhemm
Oct 14 2015 08:09
@pathikrit I guess one of the package object shadows the other?
Elmar
@elm-
Oct 14 2015 08:16
@Duhemm thanks, that helped, I could reproduce the behaviour and found at least why it is happening (check this for details: https://gist.github.com/elm-/4596a8f7dad82922f42c)
for testing I did a clean and waited until test:compile resulted in no further changes, then I changed one file (AbstractDataService) which gets correctly picked up and recompiled, when I run again it then picks up the binary change and re-compiles dependent classes. This happens a few times and might probably even result in affecting each other, thus resulting in an endless compile cycle.
I#m pretty sure before we had this behaviour sbt automatically detected depending changes and triggrered the recompile within one compile cycle (result in several "compiling x scala sources lines)
is there a build setting that could affect this?
I'm looking switches on incremental compilation, I remember the release notes and changes about using name hashing, but can't seem to find any documentation on how to check and configure it
Elmar
@elm-
Oct 14 2015 08:29
I'm trying incOptions := incOptions.value.withNameHashing(false), as settings, so far it seems to work again as intended, but have to observe.
Martin Duhem
@Duhemm
Oct 14 2015 08:30
So disabling name hashing solves your issue?
would it be possible for SBT to follow the XDG base dir spec regarding its choice of directories?
it's kind of annoying that there are still applications which dump their stuff into my home directory
Elmar
@elm-
Oct 14 2015 08:39
@Duhemm seemed like it for a minute, but no, not really. now not all dependencies are correctly recompiled, I changed the method signature for testing and get now NoSuchMethodError errors instead
Martin Duhem
@Duhemm
Oct 14 2015 08:41
Could you share your build definition? Or a reduced version that shows how you different subprojects are related?
Elmar
@elm-
Oct 14 2015 08:45
sure, here: https://gist.github.com/elm-/538a6895be605517c0a1 (only missing are dependencies)
looking at this, maybe the compiler optimization settings ...
Elmar
@elm-
Oct 14 2015 08:55
but these are all settings we have had forever, the problem only started about a month ago and there haven't been any changes to sbt for at least two weeks before that
Martin Duhem
@Duhemm
Oct 14 2015 09:01
I’m sorry, I don’t see where this may be coming from
Elmar
@elm-
Oct 14 2015 09:11
no problem, thanks for your help, I'll try the compiler settings and if the problem persists open a bug report, this looks like unintended behaviour to me
Pathikrit Bhowmick
@pathikrit
Oct 14 2015 17:16
@Duhemm: Yes. just surprised it compiles fine but doesnt run ....
Colt Frederickson
@coltfred
Oct 14 2015 19:10
I'm trying to add local .m2 folder to my sbt repositories file like the ones detailed here: http://www.scala-sbt.org/release/docs/Proxy-Repositories.html - I can't seem to find a way to do that and the link to the syntax that's accepted in that file doesn't take me anywhere useful. If a just add a file pointer with my username it works, but I want it to be based on the user running it and not have to have them change it.
Example:
[repositories]
  local
  m2local:  file:///home/user/.m2/repository
   our-nexus:  http://internal-nexus
strange highlighting, but ok.
And someone on #scala irc found the answer I couldn't find! http://www.scala-sbt.org/release/docs/Launcher-Configuration.html -- It says maven-local is for ivy, but that's a lie...
Perry
@pfn
Oct 14 2015 19:38
ugh, using FileFunction.cached is so slow with FilesInfo.hash
pfn @pfn tries to figure out how to optimize