2013-04-10 135 views
4

我加入的依賴在pom.xml中StringEscapeUtils解決不了

<dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.1</version> 
     </dependency> 

但是當我更新Maven依賴和導入使用

import org.apache.commons.lang3.StringEscapeUtils; 

EscapeStringUtils我得到它的紅色下劃線和錯誤,狀態:

The import org.apache.commons.lang3.StringEscapeUtils cannot be resolved 

Jar文件是否存在(下載)現在我該如何解決它,我沒有想法。 請幫助我。

感謝

+0

您可以請檢查庫內的jar的位置。它是否存在於正確的文件夾結構中? – 2013-04-10 07:14:18

+1

你的項目構建路徑中是否有apache-commons jar文件? – midhunhk 2013-04-10 07:16:54

+0

是的,它存在於構建路徑中。 – Shahzeb 2013-04-10 07:17:51

回答

1

如果您確信jar文件包括你應該清理項目類路徑StringEscapeUtils。

+0

這是一個maven項目。不需要在類路徑中添加jar。 – 2013-04-10 07:15:43

+0

我多次清理它但不工作 – Shahzeb 2013-04-10 07:18:26

+0

對不起,我的意思是本地存儲庫。 – 2013-04-10 07:22:07

0

我也有類似的問題,我解決了使用此:

org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(testToBeTranslated) 
0

刪除內容在.m2 \ repository \ org \ apache \ commons \ commons-lang3中。

更新項目 - 轉到eclipse項目 - > maven - >更新項目和檢查強制更新。