5

I want to give a shot to a coursier artifact fetcher, but we are using Artifactory for maven and ivy repositories, I am not sure how to set it up in with coursier. In documentation they provide this example of ENV. variable:

export COURSIER_REPOSITORIES="ivy2Local|central|sonatype:releases|jitpack|https://corporate.com/repo"

If I have artifactory ivy repo with this URL: http://myivyrepo.tld/joint-ivy-releases which also have some custom pattern :

[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]

How can I set this up with Coursier ?

RB_
  • 1,195
  • 15
  • 35

1 Answers1

0

I have struggle way too much to make this work, and I know that this question is two years old, but I think that we could benefit from having it answered.

According to Coursier cs fetch --help:

  --repository | -r  <maven|sonatype:$repo|ivy2local|bintray:$org/$repo|bintray-ivy:$org/$repo|typesafe:ivy-$repo|typesafe:$repo|sbt-plugin:$repo|scala-integration|scala-nightlies|ivy:$pattern|jitpack|clojars|jcenter|apache:$repo>
        Repository - for multiple repositories, separate with comma and/or add this option multiple times (e.g. -r central,ivy2local -r sonatype:snapshots, or equivalently -r central,ivy2local,sonatype:snapshots)

(maybe this was not the case when this question was asked) it is possible to prefix an ivy repository with ivy. What is really not clear from this help is how to provide both a custom server and a pattern, but it is in fact really simple, you must concatenate both in the argument:

cs fetch --no-default --repository http://myivyrepo.tld/joint-ivy-releases/[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]

The internal parser of Coursier will take care of detecting which part is the url and which is the pattern.

In case anyone is interested by that, all the code responsible is located in IvyRepository.parse function in coursier.

Additionally, it's possible to give metadataPattern to coursier (I don't know what that is) for ivy by separating them with a | after, like that

cs fetch --no-default --repository http://myivyrepo.tld/joint-ivy-releases/[org]/[module]/[baseRev](-[folderItegRev])/[module]-[baseRev](-[fileItegRev])(-[classifier]).[ext]|<YOUR_METADATA_OPTS>
ex0ns
  • 1,116
  • 8
  • 19