简体   繁体   English

Gradle 6.5.1 gretty 3.0.3 无法运行码头

[英]Gradle 6.5.1 gretty 3.0.3 unable to run jetty

I am trying to build my first REST API, using jersey on Eclipse.我正在尝试构建我的第一个 REST API,使用 jersey 上 Z32F7222026696F4078ZDEE58891 This is my build.gradle :这是我的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()
}

When I use gradle jettyStart or gradle jettyRunWar , getting below error:当我使用gradle jettyStartgradle jettyRunWar时,出现以下错误:

FAILURE: Build failed with an exception. FAILURE:构建失败并出现异常。

  • What went wrong: Execution failed for task ':jettyStart'.出了什么问题:任务“:jettyStart”执行失败。

Could not resolve all files for configuration ':grettyRunnerJetty94'.无法解析配置“:grettyRunnerJetty94”的所有文件。 Could not find org.gretty:gretty-runner-jetty94:3.0.3.找不到 org.gretty:gretty-runner-jetty94:3.0.3。 Required by: project:要求:项目:

I also tried gretty 2.1.0 version, but it's unreachable.我也尝试了 gretty 2.1.0 版本,但无法访问。 Gradle version is 6.5.1 Gradle版本是6.5.1

As mentioned by @Knut Forkalsrud newer gretty versions are not in maven central and you need to add jcenter() to the list of repositories:正如@Knut Forkalsrud提到的,较新的gretty版本不在 maven 中央,您需要将jcenter()添加到存储库列表中:

repositories {
    jcenter()
    mavenCentral()
    // other repositories
}

Additional Note: The order of repositories is also important (similar to maven).附加说明:存储库的顺序也很重要(类似于 maven)。 So make sure you add the jcenter() at the right place in your list of repositories.因此,请确保将jcenter()添加到存储库列表中的正确位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM