使用 vertx.io 3.0.0 和 Java 1.8.0_60
我正在尝试从 JAVA 启动一个 javascript verticle。我找到了以下文档here这说明了如何做到这一点。但它实际上在我当前的环境下不起作用。
//main class
vertx.deployVerticle("com.mycompany.services.DiscountServices");
vertx.deployVerticle("com.mycompanyservices.SupplierServices");
vertx.deployVerticle("com.mycompany.services.ReportTypeServices");
vertx.deployVerticle("RELATIVE_PATH_TO_FILE/verticle.js");
//verticle.js
// from the example: http://vertx.io/docs/vertx-core/js/#_writing_verticles
declare var vertx;
var eb = new vertx.EventBus()
eb.consumer("cbweb.validation", (message:any) => {
console.log(message);
});
console.log("Validation.js ready")
在这种情况下
- 文件路径正确。
- 尝试在路径前加上
js:
前缀来调用正确的加载程序,但没有任何机会。
关于如何做到这一点有什么想法吗?
最佳答案
我在google group for Vertx.io上问了这个问题。这是按问题修复的答案。
如果您使用 Maven:
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-lang-js</artifactId>
<version>3.0.0</version>
</dependency>
Gradle :
io.vertx:vertx-lang-js:3.0.0
关于javascript - Vertx.io 从 Java 服务器启动 JS Verticle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32956093/