Peter Pilgrim is an Oracle Java Champion, Software developer, designer and architect for the Java Platform, Agile SCRUM practitioner. Peter is a DZone MVB and is not an employee of DZone and has posted 32 posts at DZone. You can read more from them at their website. View Full User Profile

ScalaFX – Some Workarounds for SBT Issues

08.05.2012
| 2341 views |
  • submit to reddit

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.

 

 

 

 

Published at DZone with permission of Peter Pilgrim, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)