我正在尝试构建我的第一个REST,在Eclipse上使用jersey。这是我的build.gradle
plugins {
//id "com.dsvdsv.gradle.plugin" version "1.5.1"
//id 'org.gretty' version '2.1.0'
id "org.gretty" version "3.0.3"
//id 'com.bmuschko.tomcat'
id 'eclipse-wtp'
id 'war'
//id 'jetty'
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'application'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
mainClassName = 'com.example.demo.DemoApplication'
repositories {
mavenCentral()
//jcenter()
}
dependencies {
// https://mvnrepository.com/artifact/org.gretty/gretty-runner-tomcat85
//compile group: 'org.gretty', name: 'gretty-runner-tomcat85', version: '2.2.0'
implementation 'org.glassfish.jersey.containers:jersey-container-servlet:2.25.1'
implementation 'org.glassfish.jersey.inject:jersey-hk2:2.26'
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
//implementation 'com.bmuschko:gradle-tomcat-plugin:2.5'
}
test {
useJUnitPlatform()
}当我使用gradle jettyStart或gradle jettyRunWar时,出现以下错误:
失败:生成失败,出现异常。
问题所在:任务':jettyStart'.的执行失败
无法解析配置的所有文件“:grettyRunnerJetty94 94”。找不到org.gretty:94:3.0.3。要求:项目:
我也尝试了Gretty2.1.0版本,但它是不可触及的。分级版本为6.5.1
发布于 2021-04-29 15:26:30
正如@Knut Forkalsrud所提到的,较新的gretty版本不在maven中心,您需要将jcenter()添加到存储库列表中:
repositories {
jcenter()
mavenCentral()
// other repositories
}附加注意:存储库的顺序也很重要(类似于maven)。因此,确保您在存储库列表中的正确位置添加了jcenter()。
https://stackoverflow.com/questions/65969867
复制相似问题