简体   繁体   English

运行 gradle clean build 时遇到问题

[英]Facing issue while running gradle clean build

I am using Gradle 5 as my build tool for my Java application.我使用 Gradle 5 作为我的 Java 应用程序的构建工具。 I am getting below error while running gradle clean build.运行 gradle clean build 时出现以下错误。

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

PFA error image PFA 错误图像

在此处输入图片说明

Please find build.gradle file请找到build.gradle文件

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 ). jetty插件已被 Gradle 3.0 弃用,最终在 Gradle 4.0 中被删除(发行说明Github 问题)。 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.由于您使用的是 Gradle 5,我建议您查看使用gretty插件的官方构建 Java Web 应用程序指南。

Example build.gradle :示例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'
}

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

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