scalaivyapache-commons-lang3ammonite

Jupyter Notebook with Almond Scala Kernel Runs into Error


Is there a way to identify which library version should I be using for a specific scala version? For example., I want to use commons-lang3 library but whatever version I choose I run into an error.

I'm using the Almond notebook and here is the snippet cell that runs into an error:

#%%

import $ivy.`org.plotly-scala::plotly-render:0.8.1`
import $ivy.`com.github.haifengl::smile-scala:2.6.0`
import $ivy.`io.github.cibotech::evilplot:0.8.1`
import $ivy.`be.botkop::numsca:0.1.5`
import $ivy.`org.apache.commons::commons-lang3:3.2.1`
import $ivy.`org.apache.spark::spark-sql:2.4.0`
import $ivy.`sh.almond::almond-spark:0.10.9`

import org.apache.log4j.{Level, Logger}
Logger.getLogger("org").setLevel(Level.OFF)


#%%

Downloading https://repo1.maven.org/maven2/org/apache/commons/commons-lang3_2.12/3.2.1/commons-lang3_2.12-3.2.1.pom
Downloaded https://repo1.maven.org/maven2/org/apache/commons/commons-lang3_2.12/3.2.1/commons-lang3_2.12-3.2.1.pom
Downloading https://repo1.maven.org/maven2/org/apache/commons/commons-lang3_2.12/3.2.1/commons-lang3_2.12-3.2.1.pom.sha1
Downloaded https://repo1.maven.org/maven2/org/apache/commons/commons-lang3_2.12/3.2.1/commons-lang3_2.12-3.2.1.pom.sha1
Failed to resolve ivy dependencies:Error downloading org.apache.commons:commons-lang3_2.12:3.2.1
  not found: /home/joesan/.ivy2/local/org.apache.commons/commons-lang3_2.12/3.2.1/ivys/ivy.xml
  not found: https://repo1.maven.org/maven2/org/apache/commons/commons-lang3_2.12/3.2.1/commons-lang3_2.12-3.2.1.pom

Solution

  • Try to use : instead of :: after the organization (commons-lang3 is a Java library, so it does not depend on what scala version you are using):

    import $ivy.`org.apache.commons:commons-lang3:3.2.1`
    

    It is something like %% and % in the SBT build.