Created
June 9, 2013 08:02
-
-
Save esuomi/5742751 to your computer and use it in GitHub Desktop.
Gradle multimodule project with Scala and less noisy directory structure than the default Maven one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprojects { | |
apply plugin: 'scala' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
compile 'org.scala-lang:scala-library:2.10.1' | |
testCompile 'junit:junit:4.11' | |
testCompile 'org.scalatest:scalatest_2.10:1.9.1' | |
} | |
version = '1.0' | |
sourceCompatability = 1.7 | |
jar { | |
manifest.attributes provider: 'gradle' | |
} | |
tasks.withType(ScalaCompile) { | |
configure(scalaCompileOptions.forkOptions) { | |
scalaCompileOptions.useAnt = false | |
memoryMaximumSize = '1g' | |
jvmArgs = ['-XX:MaxPermSize=512m'] | |
} | |
} | |
// Maven dir style is one level too deep for no real benefit, so lets simplify it | |
// Note that Scala plugin cross compiles Java so mixing sources in this way is OK | |
sourceSets { | |
main { | |
scala { | |
srcDirs = ['src/code'] | |
} | |
resources { | |
srcDirs = ['src/resources'] | |
} | |
} | |
test { | |
scala { | |
srcDirs = ['test/code'] | |
} | |
resources { | |
srcDirs = ['src/resources'] | |
} | |
} | |
} | |
// taken from https://github.com/coacoas/jaxjug-scalatest/blob/master/build.gradle | |
/** | |
* For ScalaTest, Gradle can either use the JUnitRunner | |
* or the <scalatest> ant task. Use this to define | |
* the ant task | |
*/ | |
test { | |
ant.taskdef(name: 'scalatest', | |
classname: 'org.scalatest.tools.ScalaTestAntTask', | |
classpath: classpath.asPath) | |
} | |
/** | |
* Then use this to run the scalatest ant task. Look to | |
* http://scalatest.org/user_guide/using_the_scalatest_ant_task | |
* for documentation | |
*/ | |
test << { | |
ant.scalatest(runpath: sourceSets.test.output.asPath, | |
haltonfailure: 'true', | |
fork: 'false') { | |
reporter(type: 'stderr') | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "api", "webservice" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment