gradle eclipse 开发web项目

1: 使用eclipse 新建一个web项目

2:拷贝build.gradle,具体内容在下面

3:将项目转化为gradle项目

4:运行gradle  refesh all

build.gradle 内容如下:

写道
import org.gradle.plugins.ide.eclipse.model.Facet
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse-wtp'

sourceCompatibility = 1.8
webAppDirName = 'WebContent' // 设置 WebApp 根目录
[compileJava,compileTestJava,javadoc]*.options*.encoding = "UTF-8"

repositories {
mavenCentral()
}

dependencies {
//compile 'jstl:jstl:1.2'

compile 'log4j:log4j:1.2.17'
compile 'org.springframework:spring-webmvc:4.0.6.RELEASE'
compile 'org.codehaus.jackson:jackson-mapper-lgpl:1.9.13'
compile 'org.codehaus.jackson:jackson-core-asl:1.9.13'
compile 'javax.servlet:jstl:1.2'
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
providedCompile 'javax.servlet:servlet-api:2.5'
 testCompile group: 'junit', name: 'junit', version: '4.+'
}

test {
systemProperties 'property': 'value'
}

//eclipse.classpath.defaultOutputDir=file("${project.projectDir}/src/main/webapp/WEB-INF/classes");
eclipse.classpath.defaultOutputDir=file("${project.projectDir}/WebContent/WEB-INF/classes");
eclipse {
project {
natures += ['org.eclipse.wst.jsdt.core.jsNature' ]
buildCommand 'org.eclipse.wst.jsdt.core.javascriptValidator'
buildCommand 'org.eclipse.jdt.core.javabuilder'
buildCommand 'org.eclipse.wst.common.project.facet.core.builder'
buildCommand 'org.eclipse.wst.validation.validationbuilder'
}
wtp {
component {
//resource sourcePath: 'extra/resource', deployPath: 'deployment/resource'
//property name: 'java-output-path', value: "/${project.name}/src/main/webapp/WEB-INF/classes"

}
facet {
facet name: 'wst.jsdt.web', type: Facet.FacetType.fixed
facet name: 'jst.web', type: Facet.FacetType.fixed
facet name: 'java', type: Facet.FacetType.fixed
facet name: 'java', version: '1.8'
facet name: 'jst.web', version: '3.0'
facet name: 'wst.jsdt.web', version: '1.0'
}

}
jdt {
sourceCompatibility = 1.8
targetCompatibility = 1.8

}
}

uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}

 通过系统配置 GRADLE_USER_HOME指定jar下载目录,默认是 <USER_HOME>/.gradle

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值