user3464741 user3464741 - 1 year ago 169
Java Question

Working with ceylon import-jar

How can I import a library from maven central into a project with the ceylon import-jar command?

Please show the full command.

E.g. for "joda-time-2.9.4.jar" from "" into a local directory.

I guess it must be:

./ceylon-1.2.3/bin/ceylon import-jar --rep "" --verbose --out localdir "joda-time:joda-time/2.9.4" "joda-time-2.9.4.jar"

But as far as I can see the tool is not working (ceylon versions 1.2.2 and 1.2.3).

Working with maven central is essential.

This question is linked with The ceylon copy tool because both tools present me with a riddle.

Answer Source

1. As a (partial) answer to my question, this turned out to work:

$ ../bin/ceylon import-jar --rep flat:"../flat/" Jama/1.0.3 ../flat/Jama-1.0.3.jar

I downloaded the jar (in this case Jama-1.0.3.jar) by hand and then I was able to import it.

I had to try a lot to find out where to put the prefix "flat:", i.e. either to put it after "import" in the module descriptor "module.ceylon" or on the command line. The latter turned out to be the right choice.

But still, I haven't been able to find out how to import the jar from maven directly using the import-jar tool.

2. More detailed documentation is needed about managing modules. Specifically, there should be a clarification what the term "legacy repository" means.

Does "legacy" mean "deprecated"?

3. I hope that the following way to import dependencies into a project is not considered as "legacy" or "deprecated":

a) Rename the jar file, so that the name relfects the compressed directory structure within the jar.

b) Put the jar into a directory structure that again reflects the directory structure within the jar.

c) Put all that into the modules directory of the project, merging directories if necessary.

This seems to be the most explicit and reliable way to include dependencies into a project and I hope this way will not be deprecated or considered "legacy" at any time.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download