解決方案一:
Ctrl+Alt+Shift+s打開projuect Structure-->Livraries-->➕-->java-->選擇對應的lib目錄即可!
解決方案二:在pom.xml中添加本地jar包,類似代碼如下:
<dependency>
<groupId>htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.21-OSGi</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/htmlunit-2.21-OSGi.jar</systemPath>
</dependency>