Solve the error that the symbol cannot be found under gradle

Solve the error that the symbol cannot be found under gradle

1. Problem description

​ When writing the code, I found that when compiling, I reported a symbol error that could not be found

image-20220328194506911

​ This class is in the tools package under common. The server in the project depends on common. When I injected the AppealTool class into the server, I reported this error.

​ After inspection, it is found that the @Component annotation has been added to AppealTool

image-20220328194638938

In the startup class, this class can also be scanned

image-20220328194841015

It can be clicked through command+mouse click, which proves that there is no problem with the code logic. After multiple clean+build and invalidate caches/restart have no effect.

Two, the cause of the problem

​ Finally found that the project is dependent on the jar package to run, but I set it in the build.gradle of gradle

image-20220328195105076

As a result, the project does not generate an executable jar package, so the package location cannot be found. At this time, change false to true

image-20220328195140855

run successfully

Guess you like

Origin blog.csdn.net/weixin_42195126/article/details/123804195