为什么 Scala 找不到 org.apache.commons.lang 包?
我想使用 org.apache.commons.lang.NotImplementedException 因为它似乎是 Java/Scala 域中唯一的 NotImplementedException 实现。我记得我曾经在 Scala 2.8.1 中使用它,没有任何修改。但现在它说“object lang 不是包 org.apache.commons 的成员”。 org.apache.commons.lang 到哪里去了?
I want to use org.apache.commons.lang.NotImplementedException as it seems to be the only NotImplementedException implementation in Java/Scala domain. I can remember I used to use it with Scala 2.8.1 with no hacks. But now it says "object lang is not a member of package org.apache.commons". Where has org.apache.commons.lang gone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己刚刚找到了答案。问题是 Apache Commons 3 不再包含
lang
(而是包含 lang3,它是不同的并且不包含NotImplementedException
),因此我们需要 Apache Commons 2.6。这里不明显的是,它的 Maven 组 ID 不是org.apache.commons
,而是commons-lang
- 与其工件 ID 相同。所以我必须添加
"commons-lang" % "commons-lang" % "2.6"
依赖项并执行 sbt update 才能使其工作。I've just found the answer myself. The problem is Apache Commons 3 no longer include
lang
(including lang3 instead, which is differend and doesn't containNotImplementedException
), so we need Apache Commons 2.6. And what's inobvious here is that the Maven group id for it is notorg.apache.commons
, butcommons-lang
- the same as its artifact id.So I had to add
"commons-lang" % "commons-lang" % "2.6"
dependency and do sbt update to make it work.