PEAT Online Course -
Test-Driven Development
using Kotlin

£29.99
  • Theory 'n' practice
  • Test-driven method
  • Acceptance criteria
  • Learn to code mastery
  • Ace that job interview
  • Free updates
PREVIEW

ScalaFX – Some Workarounds for SBT Issues

24 July 2012 2 comments

2 minutes

399

ScalaFX build does not work out of the box with SBT. Here is a little bit of extra help if you are new to ScalaFX, Scala and SBT; and are attempting to build the project yourself.

The Plugin configuration has the wrong URL, if your set up does not allow GIT as HTTP protocol. Fortunately, one can easily fix this by changing it to HTTPS.

Edit projects/plugins/project/PluginBuild.scala file

import sbt._

object MyPlugins extends Build {
  lazy val root = Project("root", file(".")) dependsOn (junitXmlListener)
  lazy val junitXmlListener = uri("git://github.com/ijuma/junit_xml_listener.git#fe434773255b451a38e8d889536ebc260f4225ce")
}

Change the Protocol from "git://..." to "https://github.com"

Next, edit the build.sbt in the root folder of the project. Uncomment or remove the line:-

testListeners <<= target.map(t => Seq(new eu.henkelmann.sbt.JUnitXmlTestsListener(t.getAbsolutePath)))

I am unsure why the Xml test listener was needed in the first place. However, we do not need it out of the box to compile and build the project.

Finally, upgrade the Scala version of the project to a 2.9.2 if you want

scalaVersion := "2.9.2"

In the ScalaFX, there are two source code roots.

unmanagedSourceDirectories in Compile <++= baseDirectory { base =>
  Seq(
    base / "src",
    base / "demo"
  )
}

No changes are required here. It is decidedly a un-Maven like structure for a project.

I believe, actually, we should split up the ScalaFX project into multiple modules. One module for the core and the other for the demonstrations. Lots of engineers are familiar with this type project organisation coming from Maven style world. The project committers, however, need to agree to this manoeuvre.

In the recent JavaPosse Episode 390, Dick Wall had some comments to say about the SBT. I agree with many of his comments that SBT is no longer a simple build tool. It is anything but. It is quite hard to get your head around this domain specific language and it is an illustration when such a DSL becomes a burden on the developer, its user base. Were it not for the fact that very fast build times are achievable, because of its incremental compilation features, I believe many users would leave SBT behind.

+PP+

Hey all! Thanks for visiting. I provide fringe benefits to interested readers: checkout consultancy, training or mentorship Please make enquiries by email or
call +44 (0)7397 067 658.

Due to the Off-Payroll Working plan for the UK government, I am enforcing stricter measures on contracts. All potential public sector GOV.UK contracts engagements must be approved by QDOS and/or SJD Accounting. Please enquire for further information.