scalaammonite

Import $ivy in Ammonite


I need to import sikulixapi in an Ammonite script. I could be able to do so.

So if I do from the interactive console of Ammonite this:

@ import $ivy.`com.sikulix:sikulixapi:1.1.0` 
https://repo1.maven.org/maven2/com/sikulix/sikulixapi/1.1.0/sikulixapi-1.1.0.pom
  100,0% [##########] 5,3 KiB (37,6 KiB / s)
https://repo1.maven.org/maven2/com/nativelibs4java/bridj/0.6.2/bridj-0.6.2.pom
  100,0% [##########] 18,1 KiB (226,0 KiB / s)
https://repo1.maven.org/maven2/com/sikulix/sikulixlibslux/1.1.0/sikulixlibslux-1.1.0.pom
  100,0% [##########] 2,6 KiB (20,8 KiB / s)
https://repo1.maven.org/maven2/org/swinglabs/swing-layout/1.0.3/swing-layout-1.0.3.pom
  100,0% [##########] 858 B (6,5 KiB / s)
https://repo1.maven.org/maven2/com/nativelibs4java/nativelibs4java-parent/1.8/nativelibs4j…
  100,0% [##########] 16,8 KiB (204,3 KiB / s)
Failed to resolve ivy dependencies:
  jxgrabkey:jxgrabkey:1.0 
    not found: /home/jenkins/.ivy2/local/jxgrabkey/jxgrabkey/1.0/ivys/ivy.xml
    not found: https://repo1.maven.org/maven2/jxgrabkey/jxgrabkey/1.0/jxgrabkey-1.0.pom

But jxgrabkey does exist in Maven.

This fails also:

@ import $ivy.`jxgrabkey:jxgrabkey:1.0` 
Failed to resolve ivy dependencies:abkey/jxgrabkey/1.0/jxgrabkey-1.0.pom.sha1

I'm not using any HTTP proxy.

Other versions of sikulixapi have other problems:

@ import $ivy.`com.sikulix:sikulixapi:1.1.2` 
Failed to resolve ivy dependencies:
  com.sikulix:sikulix2tigervnc:2.0.0-SNAPSHOT 
    not found: /home/jenkins/.ivy2/local/com.sikulix/sikulix2tigervnc/2.0.0-SNAPSHOT/ivys/ivy.xml
    not found: https://repo1.maven.org/maven2/com/sikulix/sikulix2tigervnc/2.0.0-SNAPSHOT/sikulix2tigervnc-2.0.0-SNAPSHOT.pom
  com.github.vidstige:jadb:-v1.0-g94ebf38-23 
    not found: /home/jenkins/.ivy2/local/com.github.vidstige/jadb/-v1.0-g94ebf38-23/ivys/ivy.xml
    not found: https://repo1.maven.org/maven2/com/github/vidstige/jadb/-v1.0-g94ebf38-23/jadb--v1.0-g94ebf38-23.pom

@ import $ivy.`com.sikulix:sikulixapi:1.1.1` 
https://repo1.maven.org/maven2/com/sikulix/sikulixapi/1.1.1/sikulixapi-1.1.1.pom
100,0% [##########] 6,6 KiB (46,5 KiB / s)
https://repo1.maven.org/maven2/com/melloware/jintellitype/1.3.9/jintellitype-1.3.9.pom
100,0% [##########] 9,9 KiB (216,3 KiB / s)
Failed to resolve ivy dependencies:
  com.github.vidstige:jadb:-v1.0-g94ebf38-23 
    not found: /home/jenkins/.ivy2/local/com.github.vidstige/jadb/-v1.0-g94ebf38-23/ivys/ivy.xml
    not found: https://repo1.maven.org/maven2/com/github/vidstige/jadb/-v1.0-g94ebf38-23/jadb--v1.0-g94ebf38-23.pom

Tried with Ammonite 1.2.1, 1.3.3 and 1.4.0.


Solution

  • Recent versions of ammonite offer simpler ways of adding repositories:

    import $repo.`https://labs.consol.de/maven/repository`