1

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?

  • For which version of Ceylon is this? – Quintesse Jul 21 '16 at 23:07
  • The ceylon version is 1.2.3, yesterday's nightly build. Oh, I just tried with version 1.2.2 (because you asked for the version) and it works. I have to apologize, I should have tried that before ... but I tried the latest version. So it's probably rather a git hub issue if at all ... –  Jul 22 '16 at 05:48
  • It still unclear to me if it is intended that the jars are named (names with a ":" in the middle) "joda-time:joda-time/2.9.4/joda-time:joda-time-2.9.4.jar", I'd rather expected "joda-time/joda-time/2.9.4/joda-time-2.9.4.jar". –  Jul 22 '16 at 05:58

2 Answers2

0

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

FroMage
  • 5,038
  • 2
  • 20
  • 13
  • "Also, it did not download dependencies" you need to pass `--with-dependencies` for that – Quintesse Jul 22 '16 at 09:44
  • Actually, this command was made to copy _Ceylon_ repositories, not _Maven_ repos. It could be made to work, but we'd have to define how it should work first. Normally you just import the module in your module descriptor, you don't have to copy the Maven repo at all. If you want to import Maven modules into Ceylon repositories, you should look at the `ceylon import-jar` command, though ATM it does not look up jars into Maven repos. We could extend it to do that if you file an issue. – FroMage Jul 22 '16 at 09:44
  • ceylon import-jar doesn't even look up and import jars from any kind of repository. It simply doesn't import any jar! It's not working. And it doesn't recognise the --verbose flag whereas it recognises the -d flag. –  Jul 25 '16 at 12:41
0

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!

Quintesse
  • 452
  • 2
  • 9
  • Seems a bit nasty to edit my original answer with a new question. But this is the edit I removed: – Quintesse Aug 01 '16 at 17:04
  • > If import-jar is supposed to do the job, then "./bin/ceylon import-jar --rep "repo.maven.apache.org/maven2/"; --out outdir "joda-time:joda-time/2.9.4" "joda-time-2.9.4.jar" should work. But it doesn't. Answer: because that's not how `import-jar` works, it seems you keep inventing syntax where no such example or documentation is given :) – Quintesse Aug 01 '16 at 17:10
  • As mentioned by @fromage in a comment to his answer the import-jar tool doesn't currently download anything from Maven. But that would be useful so a request for that feature is being tracked here: https://github.com/ceylon/ceylon/issues/2401 – Quintesse Aug 01 '16 at 17:12