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

后端 未结 5 1019
悲&欢浪女
悲&欢浪女 2020-12-24 12:28

I\'m using MyEclipse to develop a really simple Java Struts project. Everything was working fine until I wanted to use the StringUtils class in org.apac

相关标签:
5条回答
  • 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.

    0 讨论(0)
  • 2020-12-24 12:53

    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>
    
    0 讨论(0)
  • 2020-12-24 12:53

    In src/main/java there would be a .auth folder. Open the folder, Go to AuthController.java file and delete the import io.swagger line. Restart.

    0 讨论(0)
  • 2020-12-24 13:08

    Better go with below to avoid clashes :

    import org.springframework.util.StringUtils;
    
    0 讨论(0)
  • 2020-12-24 13:12

    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?

    0 讨论(0)
提交回复
热议问题