lang-scala

Vert.x module that provides Scala support

License

License

Categories

Categories

Scala Languages
GroupId

GroupId

io.vertx
ArtifactId

ArtifactId

lang-scala_2.10
Last Version

Last Version

1.1.0-M1
Release Date

Release Date

Type

Type

jar
Description

Description

lang-scala
Vert.x module that provides Scala support
Project URL

Project URL

http://vertx.io
Project Organization

Project Organization

io.vertx
Source Code Management

Source Code Management

http://github.com/vert-x/mod-lang-scala

Download lang-scala_2.10

How to add to project

<!-- https://jarcasting.com/artifacts/io.vertx/lang-scala_2.10/ -->
<dependency>
    <groupId>io.vertx</groupId>
    <artifactId>lang-scala_2.10</artifactId>
    <version>1.1.0-M1</version>
</dependency>
// https://jarcasting.com/artifacts/io.vertx/lang-scala_2.10/
implementation 'io.vertx:lang-scala_2.10:1.1.0-M1'
// https://jarcasting.com/artifacts/io.vertx/lang-scala_2.10/
implementation ("io.vertx:lang-scala_2.10:1.1.0-M1")
'io.vertx:lang-scala_2.10:jar:1.1.0-M1'
<dependency org="io.vertx" name="lang-scala_2.10" rev="1.1.0-M1">
  <artifact name="lang-scala_2.10" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.vertx', module='lang-scala_2.10', version='1.1.0-M1')
)
libraryDependencies += "io.vertx" % "lang-scala_2.10" % "1.1.0-M1"
[io.vertx/lang-scala_2.10 "1.1.0-M1"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-compiler jar 2.10.4
org.scala-lang : scala-library jar 2.10.4

provided (3)

Group / Artifact Type Version
io.vertx : vertx-core jar 2.1.2
io.vertx : vertx-platform jar 2.1.2
io.vertx : testtools jar 2.0.3-final

test (2)

Group / Artifact Type Version
org.hamcrest : hamcrest-library jar 1.3
com.novocode : junit-interface jar 0.10

Project Modules

There are no modules declared in this project.

Vert.x 2.x is deprecated - use instead https://github.com/vert-x3/vertx-lang-scala

Scala Module for Vert.x

Scala language implementation for Vert.x.

Versions

Vert.x Scala 1.0.x is designed for Vert.x 2.1 and works with Scala 2.10

Quickstart

To use it, we’ve added a first "Hello World"-like example to the Vert.x Examples repository which can be run like this:

  1. Clone or download the Vert.x Examples Git repository

  2. Change directory to src/raw/scala and type:

    [VERTX_HOME]/bin/vertx run http/Server.scala
  3. Go to http://localhost:8080/ and you should see the message: ""This is a Verticle script!"

Using the Vert.x Scala API

The best places to look for examples on how to use the Vert.x Scala API are the Vert.x Examples repository and the Vert.x Scala testsuite. Please inspect those if you have any doubts. The following sub sections explain some of the items to bear in mind when using this API.

Type annotations for handlers in for overloaded methods

In some cases, the Scala compiler can fail to detect the type of a particular handler, for example:

+

val datagramSocket = vertx.createDatagramSocket()
datagramSocket.send("hello", "127.0.0.1", 1234, { h: AsyncResult[DatagramSocket] =>
   ...
}

+

In this example, send method call explicitly needs to define the type annotation for the async result handler. This is because there’s an overloaded method that sends a org.vertx.scala.core.buffer.Buffer instead of a String.

A possible workaround would have been to use function currying, but doing so would limit the API capability to add scala.concurrent.Future based methods, which are better suited for implementing handlers.

Plugging Vert.x Scala language extension

Vert.x 2.1 comes with Vert.x Scala language support embedded within it, but if you want to test a different version of the Vert.x Scala language implementation, follow these instructions:

  1. Download a Vert.x distribution.

  2. Open [VERTX_HOME]/conf/langs.properties file and modify this line to match the Vert.x Scala version to test:

    scala=io.vertx~lang-scala~X.Y.Z:org.vertx.scala.platform.impl.ScalaVerticleFactory

    Optionally, if you’re testing a locally built Vert.x Scala extension, you’ll need to do the following steps additionally:

  3. Download latest SBT release

  4. Put [SBT_HOME]/bin/sbt or [SBT_HOME]/bin/sbt.bar into your path

  5. Clone the Vert.x Scala source repository 4a. If you want build plugin with the base Scala version used (e.g. 2.10), execute:

    $ sbt clean publishM2
    $ [VERTX_HOME]/bin/vertx install io.vertx~lang-scala_2.10~X.Y.Z

    4b. On the other hand, if you want build plugin with a cross compiled Scala version (e.g. 2.11), execute:

    $ sbt clean +publishM2
    $ [VERTX_HOME]/bin/vertx install io.vertx~lang-scala_2.11~X.Y.Z

    For more information on building Vert.x Scala, check the contributing guide.

io.vertx

vert.x

Legacy Vert.x 2.x - use instead Vert.x 3 instead https://github.com/eclipse/vert.x

Versions

Version
1.1.0-M1
1.0.1-RC3
1.0.1-RC2
1.0.1-RC1