android gradle dom4j,gradle片段

gradle 常用配置

多模块项目 setting.gradle

rootProject.name = 'gr_spring_demo'

include "core", "dao", "web", "service", "mybatis-gener"

gradle 发布jar包到本地仓库

apply plugin: 'maven'

uploadArchives {

repositories {

mavenDeployer {

mavenLocal()

}

}

}

install {

repositories.mavenInstaller {

pom.version = "$project.version"

pom.artifactId = "pr_gr_dao"

pom.groupId = "$project.group"

}

}

gradle 打包可执行jar包

应用 application 插件

设置mainClassName、applicationName、archivesBaseName

apply plugin: 'application'

dependencies {

compile project(":common-domian")

compile project(":dubbo-api-facde")

}

applicationName = 'userscore' // name of tar, zip and script

mainClassName = 'com.tyuehd.app.Demo' // project main class name

archivesBaseName='dubbo-userscore'

spring mvc

subprojects {

apply plugin: 'java'

apply plugin: 'idea'

version = '1.1.2'

group = 'puke888'

sourceCompatibility = 1.8

targetCompatibility = 1.8

// java编译的时候缺省状态下会因为中文字符而失败

[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'

//定义版本号

ext {

springVersion = '4.1.4.RELEASE'

hibernateVersion = '4.3.1.Final'

}

repositories {

mavenLocal()

mavenCentral()

}

dependencies {

compile(

/*spring*/

'org.springframework:spring-core:4.1.4.RELEASE',

'org.springframework:spring-web:4.1.4.RELEASE',

'org.springframework:spring-webmvc:4.1.4.RELEASE',

'org.springframework:spring-aop:4.1.4.RELEASE',

'org.springframework:spring-tx:4.1.4.RELEASE',

'org.springframework:spring-context:4.1.4.RELEASE',

'org.springframework:spring-context-support:4.1.4.RELEASE',

'org.springframework:spring-test:4.1.4.RELEASE',

'org.springframework:spring-expression:4.1.4.RELEASE',

'org.springframework:spring-jdbc:4.1.4.RELEASE',

'org.springframework:spring-orm:4.1.4.RELEASE',

/*'org.springframework:spring-websocket:4.1.4.RELEASE',

'org.springframework:spring-messaging:4.1.4.RELEASE',

'com.fasterxml.jackson.core:jackson-core:2.3.0',

'com.fasterxml.jackson.core:jackson-databind:2.3.0',*/

'javax.websocket:javax.websocket-api:1.0',

'com.alibaba:druid:1.0.16',

'com.alibaba:fastjson:1.2.7',

'org.mybatis:mybatis-spring:1.2.3',

'org.mybatis:mybatis:3.2.8',

'com.oracle:ojdbc14:10.2.0.4.0',

'org.slf4j:slf4j-api:1.6.4',

'org.slf4j:slf4j-log4j12:1.6.4',

'commons-codec:commons-codec:1.8',

'commons-lang:commons-lang:2.4',

'org.aspectj:aspectjweaver:1.6.12',

'log4j:log4j:1.2.17',

'org.apache.poi:poi:3.12',

'org.apache.poi:poi-ooxml:3.12',

'org.apache.velocity:velocity:1.7',

'org.apache.velocity:velocity-tools:2.0',

'com.google.code.gson:gson:2.4',

'commons-fileupload:commons-fileupload:1.3.1',

'org.apache.httpcomponents:httpclient:4.3.6',

'dom4j:dom4j:1.6.1',

'joda-time:joda-time:2.3',

'com.github.fernandospr:javapns-jdk16:2.3.1',

'net.sf.json-lib:json-lib:2.4:jdk15',

'org.apache.tomcat:catalina:6.0.26',

// 'com.squareup.okhttp3:okhttp:3.4.1',

)

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

}

}

project(":web") {

apply plugin: 'war'

archivesBaseName = 'agnent.service.web'

group = 'puke888.web'

dependencies {

compile project(":resource_base")

compile project(":core")

compile project(":dao_jdbc")

providedCompile(

"javax.servlet:javax.servlet-api:3.1.0",

"javax.servlet.jsp:jsp-api:2.2.1-b03",

)

testCompile project(":resource_base")

}

}

project(":dao_jdbc") {

archivesBaseName = 'jdbc-dao'

dependencies {

compile project(":core")

testCompile project(":resource_base")

}

}

project(":core") {

archivesBaseName = 'core'

dependencies {

testCompile project(":resource_base")

}

}

project(":resource_base") {

archivesBaseName = 'resource-base'

}

mybatis generator 工具

apply plugin: "maven"

group = 'myutil.mybatis'

version = '1.1.3'

archivesBaseName = 'com.demo.util.mybatis.plug'

repositories {

maven{url "file:lib"}

mavenLocal()

}

configurations {

mybatisGenerator

}

dependencies {

compile("org.mybatis.generator:mybatis-generator-core:1.3.2")

compile( 'myutil.mybatis:com.demo.util.mybatis.plug:1.1.3')

mybatisGenerator 'org.mybatis.generator:mybatis-generator-core:1.3.2'

mybatisGenerator 'mysql:mysql-connector-java:5.1.36'

mybatisGenerator 'tk.mybatis:mapper:3.3.2'

mybatisGenerator 'myutil.mybatis:com.demo.util.mybatis.plug:1.1.3'

mybatisGenerator files('/lib/ojdbc14-10.2.0.4.0.jar')

}

task mybatisGenerate << {

ant.taskdef(

name: 'mbgenerator',

classname: 'org.mybatis.generator.ant.GeneratorAntTask',

classpath: configurations.mybatisGenerator.asPath

)

ant.mbgenerator(overwrite: true, configfile: 'src/main/resources/generator/generatorConfig.xml', verbose: true)

}

uploadArchives {

repositories.mavenDeployer {

repository(url: "file://lib")

}

}

spring boot demo

/*

* 这个build文件是由Gradle的 `init` 任务生成的。

* 更多关于在Gradle中构建Java项目的信息可以查看Gradle用户文档中的

* Java项目快速启动章节

* https://docs.gradle.org/3.3/userguide/tutorial_java_projects.html

*/

// 在这个段落中你可以声明你的build脚本需要的依赖和解析下载该依赖所使用的仓储位置

buildscript {

ext {

springBootVersion = '1.4.3.RELEASE'

}

repositories {

mavenCentral()

}

dependencies {

classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")

}

}

/*

* 在这个段落中你可以声明使用哪些插件

* apply plugin: 'java' 代表这是一个Java项目,需要使用java插件

* 如果想生成一个 `Intellij IDEA` 的工程,类似的如果要生成

* eclipse工程,就写 apply plugin: 'eclipse'

* 同样的我们要学的是Spring Boot,所以应用Spring Boot插件

*/

apply plugin: 'java'

apply plugin: 'idea'

apply plugin: "war"

//apply plugin: 'eclipse'

apply plugin: 'org.springframework.boot'

// 在这个段落中你可以声明编译后的Jar文件信息

jar {

baseName = 'todo'

version = '0.0.1-SNAPSHOT'

}

// 在这个段落中你可以声明在哪里可以找到你的项目依赖

repositories {

// 使用 'jcenter' 作为中心仓储查询解析你的项目依赖。

// 你可以声明任何 Maven/Ivy/file 类型的依赖类库仓储位置

mavenLocal()

mavenCentral()

}

// 在这个段落中你可以声明源文件和目标编译后的Java版本兼容性

sourceCompatibility = 1.8

targetCompatibility = 1.8

// 在这个段落你可以声明你的项目的开发和测试所需的依赖类库

dependencies {

compile('org.springframework.boot:spring-boot-starter-web')

testCompile('org.springframework.boot:spring-boot-starter-test')

providedCompile ('org.springframework.boot:spring-boot-starter-tomcat')

}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值