From 076cabbcf7142c3558dfef147194025321fd3c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E4=BC=9F?= <624371359@qq.com> Date: Tue, 11 Sep 2018 10:46:11 +0800 Subject: [PATCH] =?UTF-8?q?gradle=E9=9B=86=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/README.md b/README.md index e105349..d92605d 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,60 @@ MyBatis Generator 参考配置(插件依赖应该配置在mybatis-generator-ma ``` --------------------------------------- +gradle集成[[issues#41]](https://github.com/itfsw/mybatis-generator-plugin/issues/41)),感谢[masa-kunikata](https://github.com/masa-kunikata)提供的脚本。 +```gradle +// https://gist.github.com/masa-kunikata/daaf0f51a8ab9b808f61805407e1654c +buildscript { + repositories { + maven { url "https://plugins.gradle.org/m2/" } + } + dependencies { + classpath "gradle.plugin.com.arenagod.gradle:mybatis-generator-plugin:1.4" + } +} + +apply plugin: 'java-library' +apply plugin: "com.arenagod.gradle.MybatisGenerator" +apply plugin: 'eclipse' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + + +def mybatisGeneratorCore = 'org.mybatis.generator:mybatis-generator-core:1.3.7' +def itfswMybatisGeneratorPlugin = 'com.itfsw:mybatis-generator-plugin:1.2.10' + +mybatisGenerator { + verbose = false + configFile = "config/mybatisGenerator/generatorConfig.xml" + + dependencies { + mybatisGenerator project(':') + mybatisGenerator itfswMybatisGeneratorPlugin + mybatisGenerator mybatisGeneratorCore + } +} + +repositories { + mavenCentral() +} + +dependencies { + compile mybatisGeneratorCore + compile itfswMybatisGeneratorPlugin + testCompile 'junit:junit:4.12' +} + +def defaultEncoding = 'UTF-8' + +compileJava { + options.encoding = defaultEncoding +} +compileTestJava { + options.encoding = defaultEncoding +} +``` +--------------------------------------- ### 1. 查询单条数据插件 对应表Mapper接口增加了方法 插件: