mybatis-generator-lombok-plugin 导入jar问题 本文已参与「新人创作礼」活动,一起开启掘金创作之路。

363 阅读1分钟

 在使用mybatis自动生成mapper/dao/bean 文件时,为了配置自动get/set和bean属性注解, 需引入mybatis-generator-lombok-plugin   下载地址:GitHub - GuoGuiRong/mybatis-generator-lombok-plugin: A plugin for MyBatis Generator to use Lombok annotations instead of getters and setters

注意:此时直接在

<dependencies>
    <dependency>
        <groupId>com.chrm</groupId>
        <artifactId>mybatis-generator-lombok-plugin</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>

时generate时报错Cannot instantiate object of type com.chrm.mybatis.generator.plugins.CommentPlugin ,

需修改成在plugin里引入 即可

<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.5</version>
<configuration>
    <!-- generator 工具配置文件的位置 -->
    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
  
</configuration>
        <dependencies>
       <dependency>
            <groupId>com.chrm</groupId>
            <artifactId>mybatis-generator-lombok-plugin</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>
</plugin>

\