这个问题纠结了好久,百度上并没有完整的解决方案,最终谷歌
https://stackoverflow.com/questions/48401573/could-not-find-method-provided-for-arguments-group-javax-servlet-name-javax
There is a difference between what you report as added and your exception:
dependencies { compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0' }
The above is correct, and exists in Maven Central.
However, your error:
Could not find javax.servlet:servlet-api:3.1.0. Searched in the following locations: http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/3.1.0/servlet-api-3.1.0.pom http://repo.maven.apache.org/maven2/javax/servlet/servlet-api/3.1.0/servlet-api-3.1.0.jar Required by: project :
It clearly indicates a typo somewhere in the project where the dependency module name is missing the javax.
part in front of servlet-api
.
So you must have somewhere code like:
dependencies {
compileOnly group: 'javax.servlet', name: 'servlet-api', version:'3.1.0'
}
Notice the missing javax.
in the name attribute.
然后发现jar包下载了下来。搞定这个问题。