42 Star 290 Fork 112

摆码王子/FS-Blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 5.95 KB
一键复制 编辑 原始数据 按行查看 历史
摆码王子 提交于 2018-03-26 22:52 . update build.gradle
buildscript {
ext {
gradleDockerVersion = '1.2'
springBootVersion = '1.5.8.RELEASE'
ehcacheVersion = '2.10.4'
mysqlConnectorVersion = '5.1.44'
lombokVersion = '1.16.18'
mybatisVersion = '3.4.5'
mybatisStarterVersion = '1.3.0'
hikariCPVersion = '2.5.1'
commonMapperVersion = '3.4.4'
commonsIOVersion = '2.4'
commonsLangversion = '3.7'
commonsCodecVersion = '1.11'
fastJsonVersion = '1.2.41'
}
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
// Gradle-docker 插件
classpath("se.transmode.gradle:gradle-docker:${gradleDockerVersion}")
}
}
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'docker' // end::plugin[] // This is used as the docker image prefix (org) group = 'gregturn'
group = 'me.zbl'
version = '1.0-Release'
sourceCompatibility = 1.8
bootRun {
addResources = true
}
jar {
baseName = 'fsblog'
}
repositories {
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
maven { url "http://repo.spring.io/release" }
maven { url "http://repo.spring.io/milestone" }
maven { url "http://repo.spring.io/snapshot" }
}
configurations {
providedRuntime
compile.exclude group: 'ch.qos.logback'
mybatisGenerator
}
dependencies {
//security
//compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}")
//web
compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}")
//aop
compile("org.springframework.boot:spring-boot-starter-aop:${springBootVersion}")
//jdbc
compile("org.springframework.boot:spring-boot-starter-jdbc:${springBootVersion}")
//模板引擎
compile("org.springframework.boot:spring-boot-starter-freemarker:${springBootVersion}")
//日志
compile("org.springframework.boot:spring-boot-starter-log4j2:${springBootVersion}")
//缓存
compile("net.sf.ehcache:ehcache:${ehcacheVersion}")
//数据库驱动
compile("mysql:mysql-connector-java:${mysqlConnectorVersion}")
//连接池
compile("com.zaxxer:HikariCP:${hikariCPVersion}")
//ORM
compile("org.mybatis:mybatis:${mybatisVersion}")
compile("org.mybatis.spring.boot:mybatis-spring-boot-starter:${mybatisStarterVersion}")
//lombok插件
compile("org.projectlombok:lombok:${lombokVersion}")
//
compile 'com.lmax:disruptor:3.3.6'
//common mapper
compile("tk.mybatis:mapper:${commonMapperVersion}")
//mybatis-generator-core
mybatisGenerator 'org.mybatis.generator:mybatis-generator-core:1.3.5'
//mybatis-common-mapper-generator
mybatisGenerator 'tk.mybatis:mapper:3.4.4'
//mybatis-mysql驱动
mybatisGenerator "mysql:mysql-connector-java:${mysqlConnectorVersion}"
//运行环境(采用 jar 部署的方式时需要)
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat:${springBootVersion}")
//测试
testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
//热部署
compile("org.springframework.boot:spring-boot-devtools:${springBootVersion}")
//commons-io
compile("commons-io:commons-io:${commonsIOVersion}")
//commons-lang3
compile("org.apache.commons:commons-lang3:${commonsLangversion}")
//commons-codec
compile("commons-codec:commons-codec:${commonsCodecVersion}")
//fast-json
compile("com.alibaba:fastjson:$fastJsonVersion")
}
/* mybatisGenerator */
def getDbProperties = {
def properties = new Properties()
file("src/main/resources/mybatisGenerator/config.properties").withInputStream { inputStream ->
properties.load(inputStream)
}
properties
}
task mybatisGenerate << {
def properties = getDbProperties()
ant.properties['targetProject'] = projectDir.path
ant.properties['driverClass'] = properties.getProperty("jdbc.driverClassName")
ant.properties['connectionURL'] = properties.getProperty("jdbc.url")
ant.properties['userId'] = properties.getProperty("jdbc.username")
ant.properties['password'] = properties.getProperty("jdbc.password")
ant.properties['src_main_java'] = sourceSets.main.java.srcDirs[0].path
ant.properties['src_main_resources'] = sourceSets.main.resources.srcDirs[0].path
ant.properties['modelPackage'] = properties.getProperty("package.model")
ant.properties['mapperPackage'] = properties.getProperty("package.mapper")
ant.properties['sqlMapperPackage'] = properties.getProperty("package.xml")
ant.taskdef(
name: 'mbgenerator',
classname: 'org.mybatis.generator.ant.GeneratorAntTask',
classpath: configurations.mybatisGenerator.asPath
)
ant.mbgenerator(overwrite: true,
configfile: 'src/main/resources/mybatisGenerator/generatorConfig.xml', verbose: true) {
propertyset {
propertyref(name: 'targetProject')
propertyref(name: 'userId')
propertyref(name: 'driverClass')
propertyref(name: 'connectionURL')
propertyref(name: 'password')
propertyref(name: 'src_main_java')
propertyref(name: 'src_main_resources')
propertyref(name: 'modelPackage')
propertyref(name: 'mapperPackage')
propertyref(name: 'sqlMapperPackage')
}
}
}
// tag::task[]
task buildDocker(type: Docker, dependsOn: build) {
push = true
applicationName = jar.baseName
dockerfile = file('Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
// end::task[]
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/zbl1996/FS-Blog.git
[email protected]:zbl1996/FS-Blog.git
zbl1996
FS-Blog
FS-Blog
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385