Web applications 如何在gradle中设置webAppDirName
我正在尝试将webAppDir更改为WebContent(eclipse中的动态Web应用程序结构) 我使用的是Gradle1.7。 当我尝试做论坛中提到的同样的事情时,它会给我错误:Web applications 如何在gradle中设置webAppDirName,web-applications,gradle,build.gradle,Web Applications,Gradle,Build.gradle,我正在尝试将webAppDir更改为WebContent(eclipse中的动态Web应用程序结构) 我使用的是Gradle1.7。 当我尝试做论坛中提到的同样的事情时,它会给我错误: Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/do
Creating properties on demand (a.k.a. dynamic properties) has been deprecated
and is scheduled to be removed in Gradle 2.0.
Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
for information on the replacement for dynamic properties.
Deprecated dynamic property: "webAppDirName" on "root project 'xxxxxxxxxx", value: "WebContent".
输出WAR包含两个文件夹“WEB-INF”和“META-INF”
更新
build.gradle
webAppDirName='WebContent'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse-wtp'
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
}
configurations { moreLibs }
repositories {
flatDir { dirs "WebContent/WEB-INF/lib" }
mavenCentral()
}
dependencies {
compile fileTree(dir: "WebContent/WEB-INF/lib", include: '*.jar')
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
runtime 'javax.servlet:jstl:1.2'
}
/* Change context path (base url). otherwise defaults to name of project */
jettyRunWar.contextPath = ''
请帮忙
另一个问题:
WEB-INF文件夹也位于WebContent下。WebContent的副本是否替换classes文件夹。最终解决
答案是
project.webAppDirName='WebContent'
Build.gradle文件:
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse-wtp'
project.webAppDirName = 'WebContent'
sourceSets {
main {
java { srcDir 'src' }
resources { srcDir 'src' }
}
}
configurations { moreLibs }
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: "WebContent/WEB-INF/lib", include: '*.jar')
providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
runtime 'javax.servlet:jstl:1.2'
}
war {
exclude 'WEB-INF/lib/**'
exclude 'WEB-INF/classes/**'
}
/* Change context path (base url). otherwise defaults to name of project */
jettyRunWar.contextPath = ''
这听起来很奇怪。能否显示导致警告消息的build.gradle文件?