2

I have a transitive dependency to commons-logging from a lot of my deps and for some reason I made it explicit to control the version, and while at it set it to runtime since I don't use it anywhere myself:

     <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
        <scope>runtime</scope>
    </dependency>

With this however, my Scala compilation fails:

[INFO] --- maven-scala-plugin:2.15.2:compile (default) @ dfkka ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] /Users/viktor/dev/projects/dfkka/src/main/scala:-1: info: compiling
[INFO] /Users/viktor/dev/projects/dfkka/target/generated-sources/scalaxb:-1: info: compiling
[INFO] Compiling 72 source files to /Users/viktor/dev/projects/dfkka/target/classes at 1318518178794
[ERROR] error: error while loading AbstractLayoutManager, Missing dependency 'class org.apache.commons.logging.Log', required by /Users/viktor/.m2/repository/ar/com/fdvs/DynamicJasper/3.1.9/DynamicJasper-3.1.9.jar(ar/com/fdvs/dj/core/layout/AbstractLayoutManager.class)
[ERROR] one error found

If I change it back to

<dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>

compilation succeeds. When does scalac need these transitive deps? The presentation compiler within scala-ide seems to work…

So AbstractLayoutManager in DynamicJasper needs it, but I don't even reference that class anywhere in my code. And why does it say "loading"? Is it actually loading the class? I would really like to understand this…

Viktor Hedefalk
  • 3,572
  • 3
  • 33
  • 48
  • I'm also experiencing this problem. – david.perez Dec 23 '14 at 11:48
  • @viktor I don't know if you still care or how relevant this still is but I stumbled on to a somewhat related issue and dug in. You can read about it here http://stackoverflow.com/questions/41600346/why-does-scalac-need-a-transitive-dependency-on-the-classpath – Ittai Jan 15 '17 at 20:46
  • 1
    @Ittai Thanks!T hat particular case of mine isn't relevant anymore, but interesting read anyways… – Viktor Hedefalk Jan 20 '17 at 13:49

0 Answers0