简体   繁体   中英

Maven builds but Intellij says cannot find symbol

I have a weird problem with my intelij. I am able to build my project by maven install successfully. When I want to run single unit test on intellij, intellij builds fails with error:

Error:(15, 20) cannot find symbol class B

When I open the class, no red lines, no errors. I tried to reload maven projects, cleaned and run install by maven but when it comes to running unit test by intellij, it fails. I check settings-> compile -> excludes and there is nothing there.

What can be wrong here? Why intellij cannot build it?

I had the same problem with my test class, you can follow these step

  • Right click on project then select new->directory.Create a new directory and name it "test".

  • Right click on "test" folder then select Mark Directory As->Test Sources Root

  • Click on Navigate->Test->Create New Test Select Testing library
    Specify Class Name Select Member That's it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM