【问题标题】:Ceylon modules in different versions?不同版本的锡兰模块?
【发布时间】:2017-06-15 04:08:03
【问题描述】:

我正在尝试制作一个使用 ceylon.http.serverceylon.jsonceylon.io 模块的简单应用程序。

编译时出现以下错误:

Error:(4, 8) ceylon: source code imports two different versions of module 'com.redhat.ceylon.langtools.classfile': version '1.3.1' and version '1.3.2'
Error:(4, 8) ceylon: source code imports two different versions of module 'com.redhat.ceylon.model': version '1.3.1' and version '1.3.2'
Error:(4, 8) ceylon: source code imports two different versions of module 'com.redhat.ceylon.common': version '1.3.1' and version '1.3.2'

为什么我会得到它们?我认为 Ceylon 可以处理在不同版本中使用相同的模块。在Ceylon tour, Packages and modules 中明确表示“具有模块隔离和管理同一模块多个版本的能力的运行时”。

我的module.ceylon 看起来像这样:

native ("jvm")
module server "1.0.0" {
    import ceylon.http.server "1.3.2";
    import ceylon.json "1.3.2";
    import ceylon.io "1.3.2";
}

我的(唯一的)源文件runServer.ceylon 看起来像这样:

import ceylon.http.server { ... }
import ceylon.io { ... }

"Run the module `server`."
shared void runServer() {

    //create a HTTP server
    value server = newServer {
        //an endpoint, on the path /hello
            Endpoint {
                path = startsWith("/hello");
                //handle requests to this path
                service(Request request, Response response) =>
                        response.writeString("hello world");
            }
    };

    //start the server on port 8080
    server.start(SocketAddress("127.0.0.1",8080));

}

【问题讨论】:

    标签: ceylon


    【解决方案1】:

    您的示例代码对我有用。您是否有可能尝试使用 Ceylon 1.3.1 进行编译?我认为错误消息中的三个模块都是语言模块的依赖项,所以我怀疑ceylon.http.server 和其他导入的模块拉入ceylon.language/1.3.2 并且您的编译器添加了ceylon.language/1.3.1

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多