Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

java - 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?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...