在gradle中使用MyBatis Generator时,build.gradle配置如下:
dependencies { mybatisGenerator group: 'org.mybatis.generator', name: 'mybatis-generator-core', version: '1.3.6' mybatisGenerator('com.feixue:assembly-mybatis:1.0-SNAPSHOT') mybatisGenerator('mysql:mysql-connector-java')}//mybatis generator plugin ------ startbuildscript { repositories { mavenLocal() mavenCentral() maven { url "https://plugins.gradle.org/m2/" } } dependencies { classpath "gradle.plugin.com.arenagod.gradle:mybatis-generator-plugin:1.4" }}apply plugin: "com.arenagod.gradle.MybatisGenerator"configurations { mybatisGenerator}mybatisGenerator { verbose = true configFile = 'src/main/resources/tools/generatorConfig.xml'}//mybatis generator plugin ------ end
generatorConfig.xml文件的内容如下:
当引入扩展的mybatis generator的plugin时,要用mybatisGenerator,而不是compile。