简体   繁体   English

Intellij无法解析符号'lang3'Apache

[英]Intellij cannot resolve symbol 'lang3' apache

I would like to use StringUtils and have downloaded the "apache commons jar" zip file, copied the unzipped jar file into a lib folder in my intellij project, and added it to Libraries and to the classpath (via Project Settings). 我想使用StringUtils,并下载了“ apache commons jar” zip文件,将解压缩的jar文件复制到我的intellij项目中的lib文件夹中,并将其添加到库和类路径中(通过“项目设置”)。 Then I imported with 然后我导入

import org.apache.commons.lang3.StringUtils; 导入org.apache.commons.lang3.StringUtils;

but intelliJ can't resolve 'lang3'. 但是intelliJ无法解析'lang3'。 Does anyone have any advice? 有人有建议吗? Note: similar questions exist on stack exchange, eg. 注意:类似的问题也存在于堆栈交换中,例如。 here and here , but they're not quite the same issue and their solutions haven't helped. 在这里这里 ,但它们不是完全相同的问题,其解决方案也无济于事。

FYI I downloaded the 'common-lang3/common-lang3.jar.zip' folder from this website . 仅供参考,我从该网站下载了“ common-lang3 / common-lang3.jar.zip”文件夹。

Thanks! 谢谢!

You need to unpack the zip and add the extracted common-lang3.jar file to the module dependencies instead of the downloaded common-lang3.jar.zip file. 您需要解压缩zip并将解压缩的common-lang3.jar文件添加到模块依赖项中,而不是将下载的common-lang3.jar.zip文件添加到模块依赖 common-lang3.jar.zip

Here is the sample project: HelloStringUtils.zip . 这是示例项目: HelloStringUtils.zip

Result of the execution and import working: 执行和导入工作的结果:

你好工作

Dependency configuration screenshots: 依赖性配置屏幕截图:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM