3
How to change webAppDir to point to /web instead of src/main/webapp如何gradle這個
我試圖改變webAppDir到的WebContent(在Eclipse動態Web應用程序結構)設置webAppDirName。
我正在使用gradle 1.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/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」
UPDATE
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的副本是否替換類文件夾。
這聽起來很奇怪。你可以顯示導致警告消息的build.gradle文件嗎? –