6

I have added the dependency in pom.xml

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

but when i update maven dependencies and import the EscapeStringUtils using

import org.apache.commons.lang3.StringEscapeUtils;

i get it red underlined and error which states :

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

Jar file is there (downloaded) now how can i fix it, i have no idea. Kindly help me.

Thanks

Shahzeb Khan
  • 3,582
  • 8
  • 45
  • 79

5 Answers5

6

Thanks for all replies, i solved it by downloading manually the .jar file from the following link and overwrite the existing jar downloaded by maven. (i don't know why it started working after manual download, but after all, its working)

http://commons.apache.org/proper/commons-lang/download_lang.cgi

Shahzeb Khan
  • 3,582
  • 8
  • 45
  • 79
2

If you sure that jar file includes StringEscapeUtils in the classpath you should clean the project.

Ugur Artun
  • 1,744
  • 2
  • 23
  • 41
0

I had a similar issue and I solved using this:

org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(testToBeTranslated)
Andrea Girardi
  • 4,337
  • 13
  • 69
  • 98
0

Delete contents inside .m2\repository\org\apache\commons\commons-lang3.

Update project - Go to eclipse project -> maven -> Update Project and Check force update.

vsvishnu
  • 133
  • 1
  • 2
  • 11
0

In my case, my maven project contains both pom.xml and module-info.java files. I thought that they conflicted. Then I deleted the module-info.java file. And problem is solved.

ÖMER TAŞCI
  • 546
  • 5
  • 9