• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cuisongliu/mybatis_generator_gradle_plugin: mybatis grenator gradle plugin

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

cuisongliu/mybatis_generator_gradle_plugin

开源软件地址(OpenSource Url):

https://github.com/cuisongliu/mybatis_generator_gradle_plugin

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

Build Status Dependency Status license license

MyBatis Generator Gradle Plugin(MBG)

This plugin is based on https://github.com/mybatis/generator. This is a gradle plugin of mybatisGeneratorPlugin(mbg). This plugin has all the features of mybatisGeneratorPlugin(mbg), but the plugin realization of groovy from gradle3.3.

简体中文

Add the plugin to you project

Build script snippet for use in all Gradle versions:
buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.cuisongliu.plugin:mybatis-generator:0.9.6"
  }
}

apply plugin: "com.cuisongliu.plugin.mybatis-generator"

Build script snippet for new, incubating, plugin mechanism introduced in Gradle 2.1:

plugins {
  id "com.cuisongliu.plugin.mybatis-generator" version "0.9.6"
}

Specify settings

mbg {
  overwrite = false
  consoleable = true
  jdbc{
    driver = "com.mysql.jdbc.Driver"
    url    = "jdbc:mysql://[ip]:[port]/[dbname]?useSSL=false"
    username = "username"
    password = "password"
  }
  xml{
      resourcesProject = "src/main/java"
      mapperPlugin = tk.mybatis.mapper.generator.MapperPlugin.class
      mapperMapper = "com.cuisongliu.springboot.core.mapper.MyMapper"
      mapperPackage= "com.cuisongliu.mapper"
      modelPackage = "com.cuisongliu.entity"
      xmlPackage =   "com.cuisongliu.mapper"
      tableName ="s_system"
      objectName ="System"
      mapperSuffix ="Mapper"
  }
}

If no settings are provided, the plugin tries to use sensible defaults.

Setting Name Type Description Default
overwrite boolean Specifies whether the mojo overwrites existing files. Default is true. true
generatorFile String Location of the configuration file. generatorConfig.xml
sqlScript String Location of a SQL script file to run before generating code. null
consoleable boolean Specifies whether progress messages to the console. false
skip boolean Skip generator. false
contexts String Comma delimited list of contexts to generate. null
tableNames String Comma delimited list of table names to generate. null
Setting Name Type Description Default
jdbc driver String JDBC Driver name.Not Null null
url String JDBC URL.Not Null null
username String JDBC user name.Not Null root
password String JDBC password.Not Null null
xml javaProject String Mybatis generator output sources directory. src/main/java
resourcesProject String Mybatis generator output resources directory. src/main/resources
mapperPackage String Mybatis generator output javaClient package.Not Null null
modelPackage String Mybatis generator output javaModel package.Not Null null
xmlPackage String Mybatis generator output sqlMapper package.Not Null null
mapperPlugin Class Mybatis generator plugin class.Not Null tk.mybatis.mapper. generator.MapperPlugin. class
mapperMapper String Mybatis generator javaClient extends class.Not Null tk.mybatis.mapper. common.Mapper
tableName String Mybatis generator db table name.Not Null null
objectName String Mybatis generator object class name.Not Null null
mapperSuffix String Mybatis generator javaClient mapper suffix. Mapper

Run the mbg task

  1. Add generatorConfig.xml to your execution module.Set the variable in the table information.
  2. In the build.gradle file append Specify settings
  3. In the build.gradle directory execute gradle mbg
  4. The default support for mysql.If you use oracle or other database need to add the following additional configuration to Specify settings.
    buildscript{
        def baseUrl = "http://maven.cuisongliu.com"
        def nexusUrl = "$baseUrl/content/groups/public/"
        repositories {
            mavenLocal()
            maven { url "$nexusUrl" }
        }
        dependencies {
            classpath "com.oracle:ojdbc6:11.1.0.7.0"
        }
    }

Add buildscript before using the plugin,configure the classpath driver depends on the jar package (where the maven address changes as the case may be)




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap