0

How can I escape the hyphen in a ceylon module descriptor?

import com.fasterxml.jackson-core "2.8.4";

Edit: In this case the jar are downloaded and included in the correct file hierarchy of the local ceylon repository ./repo . So, I expect that I can handle it like any other .car . Then, the only remaining problem is to escape the hyphen in the module name.

2 Answers2

3

You can use quotes. Specifying the explicit maven: namespace is also recommended:

import maven:"com.fasterxml.jackson.core:jackson-core" "2.8.4";

See section 9.3.10. “Module descriptors” of the Ceylon language spec:

Note: quoted module names enable interoperation with Maven and other module repository systems whose module identifiers do not comply with the format specified for Ceylon module names.

Bastien Jansen
  • 8,756
  • 2
  • 35
  • 53
  • That is obviously the correct solution. But I didnt try that solution at first, because I wanted to do as if the maven dependency was a ceylon dependency (.car) and incorporate this maven dependency in the correct file hierarchy of the local ceylon repository ./repo . I expected that I can handle it like any other .car and use the ordinary syntax in the module descriptor, in order to keep it simple. Then, the only remaining problem was to escape the hyphen in the module name. But it seems better to do it as you described it. –  Feb 06 '17 at 08:29
  • I find it much easier to let the Maven interop download or reuse Maven artifacts from your local `.m2` repository :) – Bastien Jansen Feb 06 '17 at 08:33
  • I updated my answer, I thought you had the Maven coordinates right, so I simply copied them. The syntax is `groupId:artifactId`. – Bastien Jansen Feb 06 '17 at 09:27
0

As of Ceylon 1.3.2, the preferred syntax for this is to quote:

  • only the maven artifact id, since that is the bit that often has a dash in it, and
  • not the maven group id, since that is almost always a legal Ceylon module name.

So you would write:

import maven:com.fasterxml.jackson.core:"jackson-core" "2.8.8";

I'm assuming that this is the module you're trying to import.

Gavin King
  • 3,182
  • 1
  • 13
  • 11