欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

使用GRADLE给老项目打WAR包

程序员文章站 2022-06-07 08:26:58
...

 

build.gradle

 

apply plugin: 'war'

webAppDirName = 'WebRoot'
version = ''
buildDir = 'target'
sourceCompatibility='1.6'
war{
    baseName ="PCMS"
}
//定义目录结构
sourceSets {
    main {
        java {
            srcDirs = ['src/cmes/java']
        }
        resources {
            srcDirs = ['src/cmes/resources','src/plat/resources']
        }
    }
}
//加载本地依赖
dependencies {
    providedCompile fileTree(dir: System.getenv("CATALINA_HOME")+'/lib', include: '*.jar')

    providedCompile fileTree(dir: 'WebRoot/WEB-INF/lib', include: '*.jar')
}
//设置编码
tasks.withType(Compile) {
    options.encoding = "UTF-8"
}

 

 

 

gradle.properties

 

//支持中文文件
systemProp.file.encoding=UTF-8