gradle基本配置

group 'com.cloudboce'

apply plugin: 'java'
apply plugin: 'war'
//apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.hidetake.ssh'


sourceCompatibility = 1.7
targetCompatibility = 1.7

version = '1.0'
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
}
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.springframework') {
details.useVersion '4.2.4.RELEASE'
}
}
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'commons-logging') {
details.useVersion '1.2'
}
}
}

buildscript{
repositories {
jcenter()
mavenCentral()
}

dependencies {
classpath 'org.hidetake:gradle-ssh-plugin:2.6.0'
}

}

repositories {
jcenter()
mavenCentral()
}

dependencies {
def springVersion = "4.2.4.RELEASE";
compile group: 'commons-collections', name: 'commons-collections', version: '3.2'
testCompile group: 'junit', name: 'junit', version: '4.+'

//core spring
compile "org.springframework:spring-context:$springVersion"
compile "org.springframework:spring-core:$springVersion"
compile "org.springframework:spring-webmvc:$springVersion"
compile "org.springframework:spring-aop:$springVersion"

compile "org.springframework:spring-expression:$springVersion"
compile "org.springframework:spring-beans:$springVersion"
compile "org.springframework:spring-aspects:$springVersion"
compile group: 'org.aopalliance', name: 'com.springsource.org.aopalliance', version: '1.0.0'
compile group: 'org.aspectj', name: 'com.springsource.org.aspectj.weaver', version: '1.6.8.RELEASE'


//db access
compile "org.springframework:spring-jdbc:$springVersion"
compile "org.springframework:spring-orm:$springVersion"

//log4j2
def log4j_version = "2.2";
compile "org.apache.logging.log4j:log4j-api:$log4j_version"
compile "org.apache.logging.log4j:log4j-core:$log4j_version"
compile "org.apache.logging.log4j:log4j-web:$log4j_version"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"

//mybatis
compile "org.mybatis:mybatis:3.2.8"
compile "org.mybatis:mybatis-spring:1.2.2"

// jackson

compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.8.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.8.1'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.8.1'

compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0'

//c3p0
compile "c3p0:c3p0:0.9.1.2"

//proxool
compile group: 'com.cloudhopper.proxool', name: 'proxool', version: '0.9.1'
compile group: 'com.cloudhopper.proxool', name: 'proxool-cglib', version: '0.9.1'

compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.+'

compile group: 'xerces', name: 'xerces', version: '2.4.0'
compile group: 'org.codehaus.castor', name: 'castor-xml', version: '1.4.1'

compile group: 'org.aspectj', name: 'aspectjrt', version: '1.+'
compile group: 'org.aspectj', name: 'aspectjweaver', version: '1.+'
compile group: 'cglib', name: 'cglib-nodep', version: '2.+'

testCompile group: 'org.springframework', name: 'spring-test', version: springVersion
testCompile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: log4j_version

compile files('src/main/webapp/WEB-INF/lib/ojdbc6.jar')
compile files('src/main/webapp/WEB-INF/lib/BoceSMS.jar')

compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'jaxen', name: 'jaxen', version: '1.1.1'

/* Redis */
compile group: 'org.springframework.data', name: 'spring-data-redis', version: '1.7.2.RELEASE'
compile group: 'redis.clients', name: 'jedis', version: '2.8.1'

//httpclient
compile group: 'commons-httpclient', name: 'commons-httpclient', version: '3.1'
compile group: 'commons-codec', name: 'commons-codec', version: '1.2'
compile group: 'commons-logging', name: 'commons-logging', version: '1.0.4'

compile group: 'org.jasypt', name: 'jasypt', version: '1.9.2'
compile group: 'org.jasypt', name: 'jasypt-spring31', version: '1.9.0'

compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.1'
compile group: 'commons-io', name: 'commons-io', version: '2.5'
compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.6'
compile group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.6'

// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'



}

test {
systemProperties 'property': 'value'
}

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

task copyJars(type: Copy) {
from configurations.runtime
into '/src/main/webapp/WEB-INF/lib'
}

ssh.settings {
knownHosts = allowAnyHosts
}

remotes {
deployServer {
host = '192.168.6.24'
user = 'root'
password = 'bocetest123'
}
}




war {

archiveName 'cloud_server.war'
}

task shutdownTomcat() << {
ssh.run {
session(remotes.deployServer) {
println 'shut down tomcat...'
executeScript '''#!/bin/sh
cd /opt/app/apache-tomcat-7.0.67/bin
./shutdown.sh
'''
}
}
}

task del(dependsOn:shutdownTomcat) << {
ssh.run {
session(remotes.deployServer) {
println 'start deleting...'
executeScript '''#!/bin/sh
rm -rf /opt/app/apache-tomcat-7.0.67/webapps/cloud_server
rm -f /opt/app/apache-tomcat-7.0.67/webapps/cloud_server.war
'''
}
}
}

task copy(dependsOn:del) << {
ssh.run {
session(remotes.deployServer) {
println 'start copying war...'
put from: buildDir.toString() + '/libs/cloud_server.war', into: '/opt/app/apache-tomcat-7.0.67/webapps'
}
}
}

task deploy(dependsOn:copy) << {
ssh.run {
session(remotes.deployServer) {
println 'start tomcat...'
execute '/opt/app/apache-tomcat-7.0.67/bin/startup.sh'
}
}
}
/*group 'com'
version '1.0-SNAPSHOT'

apply plugin: 'war'

repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}*/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值