gradle idea java项目_IDEA使用gradle开发多module的java项目

现在尝试使用IDEA+gradle开发java项目。其中项目结构是这样的。

1eae685e46a5789b6ffb27edb35600a1.png

JFinal-ext是自己写的一base module。开发其他项目基于此base module。

Feedback是一个反馈系统。

其中build.gradle代码如下

apply plugin: 'idea'

apply plugin: 'java'

apply plugin: 'war'

apply plugin : 'jetty'

apply plugin: 'cargo'

//apply plugin: 'tomcat'

task createJavaProject << {

sourceSets*.java.srcDirs*.each { it.mkdirs() }

sourceSets*.resources.srcDirs*.each { it.mkdirs()}

}

task createWebProject(dependsOn: 'createJavaProject') << {

def webAppDir = file("$webAppDirName")

webAppDir.mkdirs()

}

sourceCompatibility = 1.5

version = '1.0'

buildscript {

repositories {

mavenCentral()

}

dependencies {

// classpath 'org.gradle.api.plugins:gradle-tomcat-plugin:1.2.3'

classpath 'org.gradle.api.plugins:gradle-cargo-plugin:0.6.1'

}

}

repositories {

mavenCentral()

}

dependencies {

testCompile group: 'junit', name: 'junit', version: '4.11'

compile project(':JFinal-ext')

def cargoVersion = '1.3.3'

cargo "org.codehaus.cargo:cargo-core-uberjar:$cargoVersion", "org.codehaus.cargo:cargo-ant:$cargoVersion"

war {

from 'src/main/java'

webInf { from 'src/main/webapp/WEB-INF/' }

webXml = file('src/main/webapp/WEB-INF/web.xml')

}

jettyRun{

webAppSourceDirectory file("$projectDir/src/main/webapp")

contextPath project.name

scanIntervalSeconds 10

reload "automatic"

}

httpPort = 8080

stopPort = 8011

stopKey = 'jetty6'

cargo {

containerId = 'jetty8x'

port = 8080

deployable {

file = file('build/libs/Feedback-1.0.war')

context = '/Feedback'

}

local {

installer {

installUrl = 'http://mirrors.yun-idc.com/eclipse//jetty/stable-8/dist/jetty-distribution-8.1.16.v20140903.tar.gz'

downloadDir = file("$buildDir/download")

extractDir = file("$buildDir/extract")

}

}

}

tasks.withType(JavaCompile) {

options.encoding = "UTF-8"

}

/*def tomcatVersion = '8.0.18'

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'

}*/

}

/*tomcat {

httpPort = 8090

stopPort = 8091

//httpsPort = 8091

//enableSSL = true

}

tomcatRun{

contextPath= project.name

URIEncoding= 'UTF-8'

reloadable = 'true'

}

*/

每次启动jetty都特别慢 有的时候终止jetty还特别慢。希望大家贴出自己的build.gradle让我参考参考。谢谢了。如果能加我Q更是感谢:562470201 谢谢

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值