Fixing Aspose + scala error: package cells contains object and package with same name: b

The scala compiler has a known defect that prevents it from handling jar files with overlapping package and class names (the scala team has declined to fix this).

This seems to happen more in obfuscated code. With Aspose, for instance, you get this error:

[error] package cells contains object and package with same name: b
[error] one of them needs to be removed from classpath
[error] import com.aspose.cells.*;
[error]        ^
scalacOptions in ThisBuild ++= List("-Yresolve-term-conflict:package")

Once you do this it will compile, and you’ll get a warning instead:

[warn] Resolving package/object name conflict in favor of package com.aspose.cells.b.a.f.  The object will be inaccessible.

For background information, see this forum post and it’s unhelpful support response, stackoverflow post that lists other options for this argument, and the corresponding ticket the Scala compiler.