簡體   English   中英

運行 gradle clean build 時遇到問題

[英]Facing issue while running gradle clean build

我使用 Gradle 5 作為我的 Java 應用程序的構建工具。 運行 gradle clean build 時出現以下錯誤。

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

PFA 錯誤圖像

在此處輸入圖片說明

請找到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.+'
}

請幫我解決這個問題。

jetty插件已被 Gradle 3.0 棄用,最終在 Gradle 4.0 中被刪除(發行說明Github 問題)。 由於您使用的是 Gradle 5,我建議您查看使用gretty插件的官方構建 Java Web 應用程序指南。

示例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