如何在scala中创建顶点

时间:2019-02-24 15:08:06

标签: scala vert.x

build.sbt如下:

name := "ScalaVertxTest"
version := "0.1"
scalaVersion := "2.12.8"
libraryDependencies += "io.vertx" %% "vertx-lang-scala" % "3.6.3"

在Scala文件中,仅尝试如下创建vertx实例:

package com.example
import io.vertx.scala.core._
object Main {
    def main (args: Array[String]): Unit = {
    println("Hello Vertx Scala")
    var vertx = Vertx.vertx()

}

sbt编译命令生成以下错误消息:

com/example/Main.scala:3:11: object vertx is not a member of package io
[error] import io.vertx.scala.core._
[error]           ^
[error] com/example/Main.scala:12:17: not found: value Vertx
[error]     var vertx = Vertx.vertx()
[error]                 ^
[error] two errors found

}

如何在Scala中创建Vertx实例?

1 个答案:

答案 0 :(得分:0)

我在Intellij IDE中构建时遇到问题。

使用控制台中的sbt进行编译,程序可以正确构建。