gpt4 book ai didi

spring-mvc - 无法将任务 ':jettyRun'添加为具有该名称的任务

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

我正在使用gretty作为构建我的 Spring 项目的容器。但是当我发出gradle clean或gradle jettyRun命令时,出现以下问题

无法添加任务':jettyRun',因为该名称的任务已经存在。

PFB我的build.gradle文件

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'
apply plugin: 'jetty' //too old, Jetty6, use gretty
apply plugin: 'org.akhikhl.gretty'
apply plugin: 'idea'
apply plugin: 'jacoco' //code coverage

def springVersion = "4.2.4.RELEASE"
def jdkVersion = 1.8
def junitVersion = "4.12"
def logbackVersion = "1.1.3"
def jclOverSlf4jVersion = "1.7.14"
def jstlVersion = "1.2"
def hamcrestVersion = "1.3"
def servletApiVersion = "3.1"

sourceCompatibility = jdkVersion
targetCompatibility = jdkVersion

repositories {
mavenLocal()
mavenCentral()
}

task wrapper(type: Wrapper) {
gradleVersion = '2.10'
}

configurations.all {
exclude group: "commons-logging", module: "commons-logging"
}

dependencies {

compile 'org.slf4j:jcl-over-slf4j:' + jclOverSlf4jVersion
compile 'ch.qos.logback:logback-classic:' + logbackVersion
compile 'org.springframework:spring-webmvc:' +springVersion
compile 'javax.servlet:jstl:' + jstlVersion
compile 'org.springframework:spring-test:' + springVersion
//exclude the build in hamcrest
testCompile('junit:junit:' + junitVersion) {
exclude group: 'org.hamcrest'
}
testCompile 'org.hamcrest:hamcrest-library:' + hamcrestVersion
//include in compile only, exclude in the war
providedCompile 'javax.servlet:javax.servlet-api:' + servletApiVersion

}

//Gretty
buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'org.akhikhl.gretty:gretty:+'
}
}

gretty {
//port = 9000
contextPath = 'loanSharks'
servletContainer = 'jetty9'
}


//For Eclipse IDE only
eclipse {

wtp {
component {

//define context path, default to project folder name
contextPath = 'loanSharks'

}

}
}

jacoco {
toolVersion = "0.7.5+"
reportsDir = file("$buildDir/reports/jacoco")
}

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}

最佳答案

甚至删除了插件:“jetty”,但我仍然遇到错误:

Execution failed for task ':jettyRun'. Cannot call TaskInputs.property(String, Object) on task ':jettyRun' after task has started execution.

关于spring-mvc - 无法将任务 ':jettyRun'添加为具有该名称的任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42051736/

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