3 commands, 2 dependencies, 1 minute.. blast off with Scala development using the mvn archetype

I go to a fair few (probably too many), tech conference and meetups. A passing observation, is that if code samples are shown a proportion of the audience will try to run them while following along. Initially, this seems counter intuitive (to try and both listen and absorbing information while also trying to perform actions as a background task), though my own experience is that this works suprisingly well for practical activities, (maybe the multi-sensory exposure helps learning and retention ?).

Anyway, the crux of this post is to get a workable Scala environemt with mvn as quickly as possible. The post assumes if you are following along that you have a reasonable internet connection (we are about to use mvn after all !), and have mvn (>= v2.0.7) installed. So, given those 2 dependencies, here the 3 commands to issue:

The first command creates a default mvn project with the expected directory layout with ‘java’ replaced by ‘scala’. Once installed, this puts mvn into interactive mode where various project settings will be requested to fulfil the creation. Weirdly, the default pom.xml pulled down has both ‘repositories’ and ‘pluginRepositories’ sections commented out. I’d recommend removing the comment marks from these, though the project will compile and run either way.

The next 2 commands should be relatively familiar to a mvn user, as they compile the default Scala src that is present and then launch the default app.

And that should be about it. If I get chance, I’ll use this as a foundation from which later posts and examples will extend.
Next step, get functioning and get functional !

Good luck and happy hacking !