0
votes

I'm trying to use log4j2 in scala. Below is my build.sbt

name := "trial"
version := "0.1"
scalaVersion := "2.13.1"
libraryDependencies += "org.apache.logging.log4j" %% "log4j-api" % "2.12.1"
libraryDependencies += "org.apache.logging.log4j" %% "log4j-core" % "2.12.1"
libraryDependencies += "org.apache.logging.log4j" %% "log4j-api-scala" % "2.12.1"

How to resolve these errors:

[warn] Note: Unresolved dependencies path:

[error] sbt.librarymanagement.ResolveException: Error downloading org.apache.logging.log4j:log4j-api_2.13:2.12.1

sbt.librarymanagement.ResolveException: Error downloading org.apache.logging.log4j:log4j-api_2.13:2.12.1

not found: /Users/username/.ivy2/local/org.apache.logging.log4j/log4j-api_2.13/2.12.1/ivys/ivy.xml

Note :

There is no directory /Users/username/.ivy2/local/

but I can see there is /Users/username/.ivy2/cache/

and plugins log4j-api,core,api-scala are present in cache.

The IDE i'm using is IntelliJ IDEA.

1

1 Answers

3
votes

There are multiple problems

  • You are using Scala 2.13 however the latest build of log4j-api-scala is for Scala 2.12.
  • The latest version of log4j-api-scala is 11.0 not 2.12.1
  • log4j-api and log4j-core are Java libraries so we should use single % instead of double%%