Maven Artifact Search suggesting non-existent version javax.servlet:servlet-api:7.0.47
已回答
In an attempt to try hands-on Baeldung's tutorial on Spring 5, I copied the AppInitializer java class from the book:

As can be seen from the screenshot, the ServletContext is unknown (an attempt to brute-force its imports results in a similar "cannot resolve" issue.
Attempting to let IDEA to add a Maven dependency results in a suggestion for javax.servlet:servlet-api:7.0.47

The problem is that this particular version (7.0.47) of javax.servlet:servlet-api is nowhere to be found in any of the Maven repositories I searched.
The only version that actually gets downloaded an resolved is 2.5.
What could be the explanation for this? (is this a bug in IDEA's Maven Artifact Search? or am I missing something?)
(IntelliJ IDEA 2022.2.2 CE)
请先登录再写评论。
Yes, there are known issue with this dialog:
IDEA-153136 Maven artifact search is inconsistent
IDEA-143434 "Add library from Maven" does not see recent artifacts from Maven Central
For searching the dependencies by class please use Dependencies tool window instead. It is currently recommended approach. Thank you.
Thank you Andrey. Could you please outline (or point to a reference that outlines) how to use that 'Dependencies tool window'?
Sure, please see Work with the Dependencies tool window.