2013-08-16 4 views
3

How to change webAppDir to point to /web instead of src/main/webappGradle을

내가있는 WebContent에 webAppDir (Eclipse에서 동적 웹 응용 프로그램 구조)를 변경하려고에 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"

업데이트가 포함되어 있습니다

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 폴더를 대체하는지 여부.

+0

이 꽤 이상한 소리 :

답변 project.webAppDirName = 'WebContent'

Build.gradle 파일입니다. 경고 메시지를 발생시키는 build.gradle 파일을 표시 할 수 있습니까? –

답변

7

마지막으로 해결되었습니다.

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 = ''