Sbt always does full rebuild because of modified binary dependency: rt.jar:
[debug]
[debug] Initial source changes:
[debug] removed:Set()
[debug] added: Set()
[debug] modified: Set()
[debug] Removed products: Set()
[debug] Modified external sources: Set()
[debug] Modified binary dependencies: Set(C:\Program Files\Java\jdk1.6.0_37\jre\lib\rt.jar)
[debug] Initial directly invalidated sources: Set()
Obviously, rt.jar wasn't changed, its created/accesses/modified dates are the same and quite old.
It's in c:\Program Files\Java\jdk1.6.0_37\jre\lib\
JAVA_HOME is set as C:\Progra~1\Java\jdk1.6.0_37
JAVA_HOME/bin is in PATH.
Any ideas why sbt thinks rt.jar was changed?
I had JAVA_HOME set to C:\Progra~1\Java\jdk1.6.0_37 and sbt resolved the dependency as C:\Program Files\Java\jdk1.6.0_37\jre\lib\rt.jar. Sbt uses java.io.File.equals() which is not correct in this case:
In sbt/compile/inc/Incremental.scala:
def externalBinaryModified(entry: String => Option[File], analysis: File => Option[Analysis], previous: Stamps, current: ReadStamps)(implicit equivS: Equiv[Stamp]): File => Boolean =
dependsOn =>
analysis(dependsOn).isEmpty &&
orTrue(
for {
name <- previous.className(dependsOn)
_ = println("Name: " + name)
e <- entry(name)
_ = println("entry: " + e)
} yield {
val resolved = Locate.resolve(e, name)
println("resolved: " + resolved)
println("dependsOn: " + dependsOn)
println("resolved != dependsOn: " + (resolved != dependsOn))
(resolved != dependsOn) || !equivS.equiv(previous.binary(dependsOn), current.binary(resolved))
}
)
gives the following output:
Name: java.lang.Object
entry: c:\Progra~1\Java\jdk1.6.0_37\jre\lib\rt.jar
resolved: c:\Progra~1\Java\jdk1.6.0_37\jre\lib\rt.jar
dependsOn: c:\Program Files\Java\jdk1.6.0_37\jre\lib\rt.jar
resolved != dependsOn: true
Thus, sbt always thinks rt.jar was changed.
Workaround would be setting JAVA_HOME to "c:\Program Files\Java\jdk1.6.0_37" Solution would be to do:
resolved.getCanonicalPath != dependsOn.getCanonicalPath
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With