Scala in OSGI container?

前端 未结 4 1399
[愿得一人]
[愿得一人] 2021-01-30 01:42

How can I code my bundle in Scala and then deploy it into OSGI container?

Do I compile it into \"java\" first or can i deploy scala straight into OSGI and use some kind

4条回答
  •  耶瑟儿~
    2021-01-30 02:14

    OSGi does not care what language you write your code in: JVM bytecode is just JVM bytecode. So:

    • compile with Scala
    • wrap the resulting classes in a bundle using bnd (just as you would for code compiled from Java sources).
    • deploy the bundle to OSGi, just as you would for a "normal" bundle (because it is a normal bundle).

    You'll notice that your bundle has dependencies on the Scala library. Again there is nothing strange about this, it's just like having dependencies in you Java code. In order for those dependencies to resolve, you need to install the Scala library bundle from scala-lang-osgi

提交回复
热议问题