简体   繁体   中英

Facing issue while running gradle clean build

I am using Gradle 5 as my build tool for my Java application. I am getting below error while running gradle clean build.

Could not set unknown property 'stopPort' for root project '1-SimpleServlet' of type org.gradle.api.Project

PFA error image

在此处输入图片说明

Please find build.gradle file

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
apply plugin: 'jetty'

stopPort = 8081 
stopKey = 'stopKey'

repositories {
    mavenCentral()
}

dependencies {
    providedCompile 'javax.servlet:servlet-api:2.5'
    providedCompile 'org.apache.commons:commons-io:1.3.2'
    testCompile group: 'junit', name: 'junit', version: '4.+'
}

Pleas help me resolve this issue.

The jetty plugin has been deprecated with Gradle 3.0 and eventually been removed in Gradle 4.0 ( Release Notes , Github Issue ). Since you're using Gradle 5, I suggest to have a look at the official Building Java Web Applications guide which uses the gretty plugin.

Example build.gradle :

plugins {
    id 'war'
    id 'eclipse'
    id 'org.gretty' version '3.0.1' 
}

repositories {
    mavenCentral()
}

dependencies {
    providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
    testCompile 'junit:junit:4.12'
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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