2

I'm trying to make a simple app that utilizes the ceylon.http.server, ceylon.json, ceylon.io modules.

When I compile, I get these errors:

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'

Why do I get them? I thought Ceylon could handle utilizing the same module in different versions. In the Ceylon tour, Packages and modules it explicitly says "A runtime that features module isolation and the ability to manage multiple versions of the same module".

My module.ceylon looks like this:

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";
}

My (only) source file runServer.ceylon looks like this:

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));

}

1 Answers1

2

Your example code works for me. Is it possible that you are trying to compile this with Ceylon 1.3.1? I think the three modules in the error message are all dependencies of the language module, so I suspect that ceylon.http.server and the other imported modules pull in ceylon.language/1.3.2 and your compiler adds ceylon.language/1.3.1.

Lucas Werkmeister
  • 2,584
  • 1
  • 17
  • 31