Error:scalac: missing or invalid dependency detected while loading class file ***

An error occurs when developing spark application, as shown in the figure,

This mistake bothered me for two days, but I generally knew it was the problem of dependency.

First of all, I reemport pom.xml , and still report an error. Adding reimport after deleting dependency is also an error. This step is basically ruled out pom.xml It’s a matter of time.

After that, I suspected that the package downloaded to the local was damaged. I went to the local Maven warehouse to check, deleted all the files in the Maven warehouse, let Maven download again, and still reported an error. Here, we exclude the damage of the local package. Maybe there is something wrong with the download.

Then, I opened the local Maven warehouse and found a file with suffix. Lastupdated in the relevant package. The jar package was not downloaded successfully. I tried to manually download the corresponding jar package and add it, but still reported an error. But the reason for the error is basically locked, which is the problem of downloading!

Finally, I reconfigured Maven’s setting.xml File, and repeat the first two steps, reload dependency, no error after running again, the problem is solved

In a word, if you encounter problems about dependency, you can basically solve them step by step according to the previous ideas. If you encounter problems, don’t be afraid. If you analyze them step by step according to the problems and feedback, you can certainly solve them.

Read More: