如何导入jar apache commons cli

时间:2017-04-28 19:03:31

标签: java apache-commons

我有一个项目需要运行,但我无法运行它,因为IntelliJ Idea无法找到apache commons jar。问题是导入

import org.apache.commons.cli.*;

我知道问题是IntelliJ无法识别它。我将jar添加到我的项目中,但它仍然无法找到它。

enter image description here

我已经在其他帖子中看到我可以使用Maven,但我没有pom.xml文件可用。

非常感谢任何帮助。

1 个答案:

答案 0 :(得分:1)

我无法重现。将JAR文件添加到依赖项并在类文件之上添加import语句后,一切都按预期工作。也许尝试更改scope

依赖关系: enter image description here

班级档案:

enter image description here