We are unable to run a mainclass . We are using sbt 13.2 against scala 2.9.3
Here is the entry in build.sbt:
mainClass in (Compile,run) := Some("com.mycompany.swlab.sparkpoc.sql.DbPing")
Let's do an "sbt run":
C:\apps\simplews>sbt run
"sbt13"
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
[info] Loading project definition from C:\apps\simplews\project
[info] Set current project to websocket-simple (in build file:/C:/apps/simplews/)
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
Here is the source file. Notice it is an object with main() method. So we should be able to execute it.
package com.mycompany.swlab.sparkpoc.sql
import org.apache.log4j.Logger
object DbPing {
import java.sql.{DriverManager, Connection}
def main(args: Array[String]) {
I have also tried to provide specific class to run as follows:
> run com.mycompany.swlab.sparkpoc.sql.DB org.apache.hadoop.hive.jdbc.HiveDriver jdbc:hive://localhost:10000/default "" ""
Here is the full output
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true
[info] Loading project definition from C:\apps\simplews\project
[info] Set current project to websocket-simple (in build file:/C:/apps/simplews/)
> run com.mycompany.swlab.sparkpoc.sql.DB org.apache.hadoop.hive.jdbc.HiveDriver jdbc:hive://localhost:10000/default "" ""
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last root/*:run for the full output.
[error] (root/*:run) No main class detected.
[error] Total time: 0 s, completed May 27, 2014 9:13:55 PM
The issue was with a corrupted project/Build.scala. I reverted to a simple build.sbt and that resolved this issue.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.