mybatis-generator-maven-plugin使用修改源码后的mybatis-generator-core

本文讲述了作者如何从1.3.2版本升级到1.3.6版本的mybatis-generator-core以解决打包签名失败问题,包括修改源码、打包jar并与Maven仓库分离的过程,以及参考网友博客获取的步骤和资源链接。
摘要由CSDN通过智能技术生成

初衷:把<if test="id != null"> 扩展为 <if test="id != null and id != ''">

step1:下载源码:Release MyBatis Generator Release 1.3.6 · mybatis/generator · GitHub

step2:导入 idea 中, 修改 mybatis-generator-core 项目中的两个类

step3:将 mybatis-generator-core重新打成 jar 包

step4:使用mybatis-generator-maven-plugin时,指定 mybatis-generator-core.jar为刚打包好的 jar;我自定义了 jar 包的位置,这样可以和 Maven 仓库jar 区分开

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.6</version>
                <configuration>
                    <!--允许移动生成的文件 -->
                    <verbose>true</verbose>
                    <!-- 是否覆盖 -->
                    <overwrite>true</overwrite>
                    <!-- 自动生成的配置 -->
                    <configurationFile>
                        src/main/resources/generatorConfig.xml</configurationFile>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.mybatis.generator</groupId>
                        <artifactId>mybatis-generator-core</artifactId>
                        <version>1.3.6</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/lib/mybatis-generator-core-1.3.6.jar</systemPath>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

遇到过的坑:最初修改 1.3.2 版本 mybatis-generator-core的源码,但是打包死活不成功,一直报签名失败,网上查阅资料之后看,看见有网友修改 1.3.6 版本的源码之后成功打包,我也试着尝试使用 1.3.6 版本,果真成功了,也祝各位好运。

网友助力:

step2 中修改代码的位置是从这位网友的文章中看到的,感谢分享:mybatis-generator空判断_mybatis generator 生成文件与字符串判空条件_ml1658503的博客-CSDN博客

step4 中指定自定义 依赖的jar是从这位网友的文章找到的思路,感谢分享:https://www.cnblogs.com/acm-bingzi/p/mybatis_generator.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值