sbt generates NoClassDefFoundError

I am trying to load the build.sbt from Odersky's Coursera  Functional Programming In Scala  - the first lesson.

The build.sbt is as follows:


Following is what I get:


2014-02-20 23:46:27,693 [148985705]   INFO - ution.rmi.RemoteProcessSupport - Process finished with exit code 0
2014-02-20 23:47:23,064 [149041076]   INFO - ution.rmi.RemoteProcessSupport - /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Djava.awt.headless=true -Dsun.rmi.transport.connectionTimeout=3600000 -Dexternal.system.id=SBT -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 13.app/lib/idea.jar:/Applications/IntelliJ IDEA 13.app/lib/resources_en.jar:/Applications/IntelliJ IDEA 13.app/lib/jdom.jar:/Applications/IntelliJ IDEA 13.app/lib/picocontainer.jar:/Applications/IntelliJ IDEA 13.app/lib/jna.jar:/Applications/IntelliJ IDEA 13.app/lib/oromatcher.jar:/Applications/IntelliJ IDEA 13.app/lib/annotations.jar:/Applications/IntelliJ IDEA 13.app/lib/trove4j.jar:/Applications/IntelliJ IDEA 13.app/lib/log4j.jar:/Applications/IntelliJ IDEA 13.app/lib/util.jar:/Applications/IntelliJ IDEA 13.app/lib/jna-utils.jar:/Applications/IntelliJ IDEA 13.app/lib/openapi.jar:/Applications/IntelliJ IDEA 13.app/lib/extensions.jar:/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar:/Users/steve/Library/Application Support/IntelliJIdea13/Scala/lib/scala-plugin.jar:/Users/steve/Library/Application Support/IntelliJIdea13/Scala/lib/scala-library.jar" com.intellij.openapi.externalSystem.service.RemoteExternalSystemFacadeImpl org.jetbrains.sbt.project.SbtProjectResolver org.jetbrains.sbt.project.SbtTaskManager
2014-02-20 23:47:23,368 [149041380]   INFO - ution.rmi.RemoteProcessSupport - Port/ID: 18295/RemoteExternalSystemFacadeImpl59c3358e
2014-02-20 23:47:23,841 [149041853]   WARN - nal.AbstractExternalSystemTask - Exception in thread "main" java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException:
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

com.intellij.openapi.externalSystem.model.ExternalSystemException: Exception in thread "main" java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException:
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

 at com.intellij.openapi.externalSystem.service.remote.wrapper.ExternalSystemProjectResolverWrapper.resolveProjectInfo(ExternalSystemProjectResolverWrapper.java:59)
 at com.intellij.openapi.externalSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:48)
 at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:137)
 at com.intellij.openapi.externalSystem.service.internal.AbstractExternalSystemTask.execute(AbstractExternalSystemTask.java:123)
 at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$3.execute(ExternalSystemUtil.java:471)
 at com.intellij.openapi.externalSystem.util.ExternalSystemUtil$4$1.run(ExternalSystemUtil.java:540)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$TaskRunnable.run(ProgressManagerImpl.java:464)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$6.run(ProgressManagerImpl.java:274)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl$2.run(ProgressManagerImpl.java:178)
 at com.intellij.openapi.progress.ProgressManager.executeProcessUnderProgress(ProgressManager.java:209)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:212)
 at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcess(ProgressManagerImpl.java:171)
 at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:642)
 at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:420)
 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
 at java.util.concurrent.FutureTask.run(FutureTask.java:138)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
 at java.lang.Thread.run(Thread.java:695)
 at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:150)

and on and on ..

Here is the build.sbt


name <<= submitProjectName(pname => "progfun-"+ pname)

version := "1.0.0"

scalaVersion := "2.10.2"

scalacOptions ++= Seq("-deprecation", "-feature")

libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % "test"

libraryDependencies += "junit" % "junit" % "4.10" % "test"

// This setting defines the project to which a solution is submitted. When creating a
// handout, the 'createHandout' task will make sure that its value is correct.
submitProjectName := "recfun"

// See documentation in ProgFunBuild.scala
projectDetailsMap := {
val currentCourseId = "progfun-003"
Map(
  "example" ->  ProjectDetails(
                  packageName = "example",
                  assignmentPartId = "fTzFogNl",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "recfun" ->     ProjectDetails(
                  packageName = "recfun",
                  assignmentPartId = "3Rarn9Ki",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "funsets" ->    ProjectDetails(
                  packageName = "funsets",
                  assignmentPartId = "fBXOL6Qd",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "objsets" ->    ProjectDetails(
                  packageName = "objsets",
                  assignmentPartId = "95dMMEz7",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "patmat" ->     ProjectDetails(
                  packageName = "patmat",
                  assignmentPartId = "3gPmpcif",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "forcomp" ->    ProjectDetails(
                  packageName = "forcomp",
                  assignmentPartId = "fG1oZGIO",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId),
  "streams" ->    ProjectDetails(
                  packageName = "streams",
                  assignmentPartId = "CWKgCFCi",
                  maxScore = 10d,
                  styleScoreRatio = 0.2,
                  courseId=currentCourseId)//,
  // "simulations" -> ProjectDetails(
  //                  packageName = "simulations",
  //                  assignmentPartId = "iYs4GARk",
  //                  maxScore = 10d,
  //                  styleScoreRatio = 0.2,
  //                  courseId="progfun2-001"),
  // "interpreter" -> ProjectDetails(
  //                  packageName = "interpreter",
  //                  assignmentPartId = "1SZhe1Ut",
  //                  maxScore = 10d,
  //                  styleScoreRatio = 0.2,
  //                  courseId="progfun2-001")
)
}

// Files that we hand out to the students
handoutFiles <<= (baseDirectory, projectDetailsMap, commonSourcePackages) map { (basedir, detailsMap, commonSrcs) =>
  (projectName: String) => {
    val details = detailsMap.getOrElse(projectName, sys.error("Unknown project name: "+ projectName))
    val commonFiles = (PathFinder.empty /: commonSrcs)((files, pkg) =>
      files +++ (basedir / "src" / "main" / "scala" / pkg ** "*.scala")
    )
    (basedir / "src" / "main" / "scala" / details.packageName ** "*.scala") +++
    commonFiles +++
    (basedir / "src" / "main" / "resources" / details.packageName ** "*") +++
    (basedir / "src" / "test" / "scala" / details.packageName ** "*.scala") +++
    (basedir / "build.sbt") +++
    (basedir / "project" / "build.properties") +++
    (basedir / "project" ** ("*.scala" || "*.sbt")) +++
    (basedir / "project" / "scalastyle_config.xml") +++
    (basedir / "lib_managed" ** "*.jar") +++
    (basedir * (".classpath" || ".project")) +++
    (basedir / ".settings" / "org.scala-ide.sdt.core.prefs")
  }
}

// This setting allows to restrict the source files that are compiled and tested
// to one specific project. It should be either the empty string, in which case all
// projects are included, or one of the project names from the projectDetailsMap.
currentProject := ""

// Packages in src/main/scala that are used in every project. Included in every
// handout, submission.
commonSourcePackages += "common"

// Packages in src/test/scala that are used for grading projects. Always included
// compiling tests, grading a project.
gradingTestPackages += "grading"

Please sign in to leave a comment.