I’ve decided to deliberately put some time aside to get back to coding and explore some of the technologies that the day job doesn’t allow time for. It is an opportunity to get more deep in to tools that I have had an interest in for a while, and so I thought I would put a hobby project together using the following:
Scala
Given the uncertainty around the Java language, even before Oracle took it over, I keep coming back to the question of what is likely to replace Java. Scala, to me at least, looks to be a genuine contender.
Gradle
For all that Maven is a pain in the proverbial, I still prefer it to writing reams and reams of Ant configuration that gets copied and pasted across multiple projects. Perhaps Gradle is the answer? Let’s find out.
Getting Started
So, the first thing to do is get gradle down. The installation instructions on Gradle’s site are pretty clear so there is no need to repeat them here. You will need the Scala plugin though. The bad news is that this plugin does not support ScalaTest out of the box, so let’s have a look at what’s needed.
First off, here’s the build.gradle
setup as suggested by Scala’s Gradle plugin page:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
So far, so good. What we do need, though, is to add ScalaTest to our dependencies:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
After some mucking about it turns out that this isn’t enough, either, as Gradle’s Scala plugin doesn’t support ScalaTest. We need to get in amongst the test phase and make use of ScalaTest’s Ant support in order to get Gradle’s test phase to acknowledge the existence of ScalaTest classes. So, we end up with this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Thanks to Gradle’s user mailing list for leading me here. There is also an enhancement logged against Gradle to include this support out of the box.