Maven package error: org.apache.commons-lang does not exist (Java)

Adding following dependency to pom.xml in dependencies tag helped me:

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

I did "mvn clean install -U" without settings.xml, so it erred. Then I added settings.xml, did "mvn clean install -U", it said "error:org.apache.commons-lang does not exist". I know the code was built successfully on another machine. So it was not my code. After about 2 or 3 hours, I finally realized it was .m2\repository was corrupted by my first run. So just delete "repository" folder complete and run "mvn clean install -U" and succeeded.


Try running the following commands and examine the output:

$ mvn dependency:tree
$ mvn help:effective-pom

Look for commons-lang, maybe something will draw your attention like excludes or dependency overrides. Also, is:

$ mvn dependency:copy-dependencies

copying commons-lang JAR to your target?

Tags:

Java

Maven