为什么 Scala 找不到 org.apache.commons.lang 包? [英] Why can't Scala find org.apache.commons.lang package?

查看:50
本文介绍了为什么 Scala 找不到 org.apache.commons.lang 包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 org.apache.commons.lang.NotImplementedException 因为它似乎是 Java/Scala 域中唯一的 NotImplementedException 实现.我记得我曾经将它与 Scala 2.8.1 一起使用,没有任何黑客攻击.但现在它说对象 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?

推荐答案

我刚刚自己找到了答案.问题是 Apache Commons 3 不再包含 lang(包括 lang3,它是不同的并且不包含 NotImplementedException),所以我们需要 Apache Commons 2.6.这里不明显的是,它的 Maven 组 ID 不是 org.apache.commons,而是 commons-lang - 与其工件 ID 相同.

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 contain NotImplementedException), so we need Apache Commons 2.6. And what's inobvious here is that the Maven group id for it is not org.apache.commons, but commons-lang - the same as its artifact id.

所以我不得不添加 "commons-lang" % "commons-lang" % "2.6" 依赖并做 sbt 更新以使其工作.

So I had to add "commons-lang" % "commons-lang" % "2.6" dependency and do sbt update to make it work.

这篇关于为什么 Scala 找不到 org.apache.commons.lang 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆