Search code examples
copyceylon

The ceylon copy tool


I'm using the ceylon copy command of ceylon version 1.2.3 to download a dependency:

./bin/ceylon copy --rep  "http://repo.maven.apache.org/maven2/" -out outdir "joda-time:joda-time/2.9.4"

Why is the result that the tools skips downloading it?

Module joda-time:joda-time/2.9.4 [1/1]) Skipped.

The tool looks - among others - for:

http://repo.maven.apache.org/maven2//joda-time:joda-time/2.9.4/joda-time:joda-time-2.9.4.jar 

... but it should look for:

http://repo.maven.apache.org/maven2/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar

Logically the following should then work:

./bin/ceylon copy --rep  "http://repo.maven.apache.org/maven2/" --out here --verbose --jvm "joda-time/2.9.4"

... but it tells me:

... Module joda-time/2.9.4 not found ...

... similarily with:

./bin/ceylon copy --rep  "http://repo.maven.apache.org/maven2/" --out here --verbose --jvm "joda-time-2.9.4.jar"

... and with:

./bin/ceylon copy --rep  "http://repo.maven.apache.org/maven2/" --out here --verbose --jvm "joda-time-2.9.4"

How can I make the copy tool construct the url correctly and get the module downloaded to my local repository?


Solution

  • Really the correct answer here is that the copy tool is not meant for copying Maven modules.

    The whole idea of the copy tool is that you have an already compiled module, possibly with dependencies, and you want to copy it to some other repository to be able to run it there. Depending on your use-case you might want to include it's dependencies while copying or not.

    In this scenario copying the Maven modules doesn't make too much sense because a) they would be somehow converted from being Maven modules into Ceylon modules (this is not always a trivial process, and that's why we have a special tool ceylon import-jar to help you do that). And b) at the same time your importing code would still refer to the Maven imports which means that even if the copy tool would have copied those Maven modules your original module would still use the modules from the Maven repository! You'd have to change the imports and recompile the code to make this work.

    So the bug you encountered is Ceylon 1.2.2 even trying to do so. I've just made a change in the 1.2.3 copy tool where it will always skip any modules that don't come from a Ceylon repository. Its documentation has been updated to make that clear.

    Thanks for bringing this to our attention!