apply plugin: 'war' webAppDirName = 'WebContent' sourceSets { main { java { srcDir 'src' } } } war { baseName = project.name; //classpath fileTree('additionalLibs','WebContent/WEB-INF/repository/plugins') //println(destinationDir.path.toString()); //设置war包输出目录 //destinationDir = new File(destinationDir.path.toString().replace('WEB-INF/lib','WEB-INF/repository/plugins')) //println(destinationDir.path.toString()); } dependencies { tasks.withType(JavaCompile) { options.encoding = "UTF-8" } providedCompile fileTree(dir:'WebContent/WEB-INF/lib',include:'*.jar') //providedRuntime fileTree(dir:'WebContent/WEB-INF/repository/plugins',include:'*.jar') }