Note: information on this page refers to Ceylon 1.2, not to the current release.
Ceylon's module system integrates with Maven repositores, and can obtain
jar archives) from a Maven repository via Aether.
Maven modules are seamlessly supported in the Ceylon module descriptor, but:
- the module name must be quoted, and
:separator must be used to separate Maven group and artifact ids.
import "org.hibernate:hibernate-core" "5.0.4.Final";
Maven group and artifact ids
Ceylon uses a single identifier for module names, but Maven uses a group id
together with an artifact id. So to import the Maven module with group id
org.hibernate and artifact id
hibernate-core, we formed a module name
by concatenating the two identifiers with a
: (colon) and quoting
the resulting identifier, resulting in the module name
"org.hibernate:hibernate-core" seen above.
Specifying explicit Maven settings
If you have special requirements and need a specific Maven
you can specify the file using the
ceylon compile --rep aether:/path/to/special/setting.xml com.example.foo
Resolving Maven conflicts
Very often, when working with legacy Maven repositories, we encounter one or all of:
- versioning conflicts,
- undeclared dependencies, or
- the need to export promote transitive dependencies.
These problems arise from the fact that Maven metadata is often only tested with a flat classpath, and breaks when executing on isolated classloaders in Ceylon.
In such scenarios, there are two main ways to proceed:
- run your Ceylon program on a flat classpath, using the
--flat-classpathflag of the command line tools, or
- use a module overrides file to resolve the problems individually by adjusting the module dependencies.