Skip to content

Instantly share code, notes, and snippets.

@diegopacheco
Created January 11, 2016 19:38
Show Gist options
  • Save diegopacheco/96df885bd6d6e0bd8cd0 to your computer and use it in GitHub Desktop.
Save diegopacheco/96df885bd6d6e0bd8cd0 to your computer and use it in GitHub Desktop.
How main class in Scala with Gradle?

[build.gradle]

apply plugin: 'scala'

repositories{
    mavenCentral()
    mavenLocal()
}

dependencies{
    compile "org.scala-lang:scala-library:2.11.7"
}

task run(type: JavaExec, dependsOn: classes) {
    main = 'Main'
    classpath sourceSets.main.runtimeClasspath
    classpath configurations.runtime
}

[Main.scala]

object Main extends App {
  println("Hello, world")
}

[Terminal]

gradle run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment