user3464741
user3464741

Reputation:

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?

Upvotes: 1

Views: 78

Answers (2)

Quintesse
Quintesse

Reputation: 462

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!

Upvotes: 0

FroMage
FroMage

Reputation: 5186

Modules with : in their names are resolved to be Maven modules in Ceylon 1.2.2+, so the --rep "http://repo.maven.apache.org/maven2/" is superfluous.

However, it does not really work in 1.2.2, because the resulting repository contains outdir/joda-time:joda-time/2.9.4/joda-time:joda-time-2.9.4.jar which is never going to be resolved by Ceylon (because the name contains a : it will only try to resolve it from Maven repos, not Ceylon repos). So that's a bug.

Also, it did not download dependencies or materialised a module.xml to describe them, so that's another bug.

Now, if you try it in Ceylon 1.2.3 (git master) it will say Skipped and it could be due to the fact that we've added namespaces for Maven imports, and so the syntax could be maven:joda-time:joda-time/2.9.4 (it's really in flux ATM). Except if you try that you'll get an exception, so that's a third bug.

Could you report them please? https://github.com/ceylon/ceylon/issues/new

Upvotes: 0

Related Questions