Hi,
I am facing one issue with gradle while building scala code.
$gradle makeJar
Error : org.gradle.api.tasks.TaskExecutionException : Execution failed for task ‘:compileScala’.
Caused by : java.lang.NoClassDefFoundError: scala/Function1
$gradle -v
Gradle version - 1.6
groovy - 1.8.6
Ant - 1.8.4
ivy - 2.2.0
jvm - 1.7.0_55
OS - Linux 2.6x
My build.gradle file is below -
sourceCompatibility = ‘1.6’
apply plugin: ‘scala’
def mypath = ‘file://’+new File(‘test/lib’).absolutePath
repositories {
flatDir dirs:"${mypath}"
}
configurations{
scalaPackage
}
sourceSets{
main{
scala{
srcDirs = [‘test/src/scala’]
}
}
}
dependencies {
compile fileTree(dir: mypath, includes: [’*.jar’])
}
task sourcePath{
sourceSets.main.scala.srcDirs = sourceSets.main.scala.srcDirs
sourceSets.main.java.srcDirs = []
}
task makeJar(type: Jar, dependsOn: compileScala){
archivename = "mytest.jar"
destinationDir = file(“test/oplib”)
from "build/classes"
classpath = configurations.scalaPackage
}
compileScala.dependsOn sourcePath
Here my scala source code is present in - ./test/src/scala/test.scala
scala jar files present in - ./test/lib
expected output location - ./test/oplib
Is there anything wrong with build.gradle file which might be resulting in this error. Kindly suggest.
Many Thanks, Pralay