2013
August
-
A Quick-start for Scala and Gradle
For those interested, here’s a quick and simple project to get you started using Gradle and Scala together:
build.gradle1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
apply plugin: 'scala' repositories{ mavenCentral() mavenLocal() } dependencies{ compile 'org.slf4j:slf4j-api:1.7.5' compile "org.scala-lang:scala-library:2.10.1" testCompile "junit:junit:4.11" } task run(type: JavaExec, dependsOn: classes) { main = 'Main' classpath sourceSets.main.runtimeClasspath classpath configurations.runtime }
src/main/scala/Main.scala1 2 3
object Main extends App { println("Hello, world") }
You can run the app using the custom task
run
:1 2 3 4 5 6 7 8 9 10 11
$ gradle run :compileJava :compileScala :processResources :classes :run Hello, world BUILD SUCCESSFUL Total time: 9.79 secs
Remember to add
--daemon
for faster startup times for your Gradle builds.Have fun!
2010
December
-
GlassFish Administration: The REST of the Story Part II - Deploying Apps Using Scala
In a previous post (far too long ago :), I began showing off the RESTful administration API in GlassFish v3. In GlassFish Administration: The REST of the Story Part I, I showed the basics of the API, what to send, what you get back, etc. In this post, I want to show a practical use of the API, namely, deploying an application, and this time, for no particular reason other than I’m trying to learn the language, we’ll do it in Scala.