사용자 도구

사이트 도구


gradle:tomcat

문서의 이전 판입니다!


Gradle Tomcat Plugin

apply plugin: 'tomcat'

의존성 설정

buildscript {
    repositories {
        add(new org.apache.ivy.plugins.resolver.URLResolver()) {
            name = 'GitHub'
            addArtifactPattern 'http://cloud.github.com/downloads/[organisation]/[module]/[module]-[revision].[ext]'
        }
    }
 
    dependencies {
        classpath 'bmuschko:gradle-tomcat-plugin:0.9.5'
    }
}
 
repositories {
    mavenCentral()
}
 
// For Tomcat 6
dependencies {
    def tomcatVersion = '6.0.29'
    tomcat "org.apache.tomcat:catalina:${tomcatVersion}",
           "org.apache.tomcat:coyote:${tomcatVersion}",
           "org.apache.tomcat:jasper:${tomcatVersion}"
}
 
// For Tomcat 7
dependencies {
    def tomcatVersion = '7.0.11'
    tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
           "org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}"
    tomcat("org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}") {
        exclude group: 'org.eclipse.jdt.core.compiler', module: 'ecj'
    }
}

태스크들

  • tomcatRun : 압축풀린 웹 애플리케이션용 톰캣 인스턴스를 실행한다.
  • tomcatRunWar : 톰캣 인스턴스를 실행하면서 WAR를 배포한다.
  • tomcatStop : 톰캣 인스턴스를 종료한다.
  • tomcatJasper : JSP 컴파일러로 JSP 페이지를 java 소스로 변환한다.

설정하기

  • 톰캣 실행환경설정
    tomcatRun {
        httpPort = 8090
        httpsPort = 8091
        enableSSL = true
        URIEncoding = 'utf-8'
        contextPath = ''
        configFile = file('context.xml') // 기본값 src/main/webapp/META-INF/context.xml
    }
     
    // tomcatRun과 tomcatRunWar 공통 설정
    [tomcatRun, tomcatRunWar]*.configFile = file('context.xml')
  • <Context/> 설정
  • Jasper 컴파일러 환경 설정
    jasper {
        validateXml = true
        uriroot = 'webapp' // 웹 애플리케이션 루트 디렉토리 기본 src/main/webapp
        compilerSourceVM = '1.6'
        compilerTargetVM = '1.6'
        javaEncoding = 'utf-8' // 생성된 Java 소스 파일 인코딩
        webXmlFragment = file("$webAppDir/WEB-INF/generated_web.xml")
        outputDir = file("$webAppDir/WEB-INF/src")
    }
gradle/tomcat.1350363802.txt.gz · 마지막으로 수정됨: 2012/10/16 14:03 저자 kwon37xi