gpt4 book ai didi

gradle - 找不到参数[{group = javax.servlet,name = javax.servlet-api,version = 3.1.0}的提供方法()

转载 作者:行者123 更新时间:2023-12-03 03:40:00 25 4
gpt4 key购买 nike

我收到以下错误:

Could not find method provided() for arguments [{group=javax.servlet, name=javax.servlet-api, version=3.1.0}]



我尝试了几种不同的方法,发现遇到类似问题但无济于事的人。我添加了以下依赖关系,但
repositories {
mavenLocal()
mavenCentral()
maven { url "http://repo.maven.apache.org/maven2" }
provided group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'

如果删除 javax.servlet,我将回到原始错误:
Could not find method providedCompile() for arguments [{group=javax.servlet, name=javax.servlet-api, version=3.1.0}]

更新1:

添加后出现新错误:
dependencies {
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
}

错误
> 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 :

更新:

我补充说:
allProjects {

apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'

jcenter()
mavenCentral()

version = '0.0.1-SNAPSHOT'
group = 'com.lidl.digital.ecom.ratings'

dependencies {
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version:'3.1.0'
}
}

现在错误是:

  • What went wrong: A problem occurred evaluating root project 'product-rating-parent'.

    Could not set unknown property 'sourceCompatibility' for object of type org.gradle.api.internal.initialization.DefaultScriptHandler.



  • 在修复此发布的问题之前,我已经看到此错误,因此不确定是否已修复。当我将鼠标悬停在gradle文件中的任何内容上时,它说 cannot resolve 'whatever I hover over'

最佳答案

似乎您在错误的位置添加了依赖性。依存关系在dependencies块中声明如下

dependencies {
provided group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
}

但是在您的情况下,它在 repositories中声明。

关于gradle - 找不到参数[{group = javax.servlet,name = javax.servlet-api,version = 3.1.0}的提供方法(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48401573/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com