为项目添加web文件夹
为项目配置web属性
java版本这里一定要大于1.7
并且为项目生成web.xml
修改build.gradle文件
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war' // apply plugin: 'war':指定为web项目,在执行build时便生成项目的war包。
sourceCompatibility = 1.7
version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
dependencies {
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
}
test {
systemProperties 'property': 'value'
}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
项目成功跑起来了