maven “cannot find symbol” message unhelpful

后端 未结 15 1796
挽巷
挽巷 2020-11-28 12:11

This is a really simple question, and it\'s probably a setting somewhere I don\'t know about, but Google is being particularly unhelpful for this question, giving results ab

相关标签:
15条回答
  • 2020-11-28 13:07

    My guess the compiler is complaining about an invalid annotation. I've noticed that Eclipse doesnt show all errors, like a comma at the end of an array in a annotation. But the standard javac does.

    0 讨论(0)
  • 2020-11-28 13:07

    I had the same issue with maven. It happens that my problem was, maven was generating the folders with differenc case names. I was expecting a .service.MyFile but in the target folder it was Service/MyFile and java is a case sensitive. It took me a few hours to find out, recommend you to check it out.

    0 讨论(0)
  • 2020-11-28 13:08

    Perhaps you should check your IDE case sensitive properties. I had the same problem, and solved it by making Idea case-sensitive (for my filesystem is case sensitive): https://confluence.jetbrains.com/display/IDEADEV/Filesystem+Case-Sensitivity+Mismatch

    0 讨论(0)
  • 2020-11-28 13:09

    This is a bug in the Maven compiler plugin, related to JDK7 I think. Works fine with JDK6.

    0 讨论(0)
  • 2020-11-28 13:10

    Even I am using Java 7, maven 2.2.1 and was getting the same error, I removed <scope>tests</scope> from my pom and used

    mvn clean -DskipTests=true install to successfully build my projects, without upgrading my maven version.

    0 讨论(0)
  • 2020-11-28 13:12

    I had the same problem. The reason was that I had two JAR files were not added through the Maven dependency, so when I ran mvn compile, the console display the error error:

    Symbol cannot be found,Class...".

    To fix it:

    1. Remove the JAR files from build path
    2. Add to build path
    3. Run mvn compile
    0 讨论(0)
提交回复
热议问题