人生新手 2019-10-29 15:33 采纳率: 0%
浏览 476

mybatis-genertor无法实例化自定义插件

配置mybatis-genertor自动生成模型,添加了自定义的序列化类以及分页类。我已按照网上
的方式将我的扩展文件夹打包成jar包,并且安装到本地maven中并在pom文件依赖添加该jar
包的引用,配置如下

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <!--Mybatis-generator插件,用于自动生成Mapper和POJO-->
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <configuration>
                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                </configuration>
                <executions>
                    <execution>
                        <id>Generate MyBatis Artifacts</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.mybatis.generator</groupId>
                        <artifactId>mybatis-generator-core</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                    <dependency>
                        <groupId>org.micropay</groupId>
                        <artifactId>micropay-dal-plugin</artifactId>
                        <version>1.0.0</version>
<!--                        <scope>system</scope>-->
<!--                       
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

genertor配置文件:


        <!-- 为生成的Java模型创建一个toString方法 -->
        <plugin type="org.mybatis.generator.plugins.ToStringPlugin"></plugin>

        <!-- 为生成的Java模型类添加序列化接口,并生成serialVersionUID字段 -->
        <plugin type="org.micropay.dal.plugin.SerializablePlugin">
<!--        <plugin type="org.mybatis.generator.plugins.SerializablePlugin">-->
            <property name="suppressJavaInterface" value="false"/>
        </plugin>

        <!-- 生成一个新的selectByExample方法,这个方法可以接收offset和limit参数,主要用来实现分页 -->
        <plugin type="org.micropay.dal.plugin.PaginationPlugin"></plugin>
<!--        <plugin type="org.mybatis.generator.plugins.PaginationPlugin"></plugin>-->

        <!-- Java模型生成equals和hashcode方法 -->
        <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"></plugin>

        <!-- 生成的代码去掉注释 -->
        <commentGenerator type="org.micropay.dal.plugin.CommentGenerator">
<!--        <commentGenerator type="org.mybatis.generator.plugins.CommentGenerator">-->
            <property name="suppressAllComments" value="true"/>
            <property name="suppressDate" value="true"/>
        </commentGenerator>

        <!-- 数据库连接 -->
        <jdbcConnection driverClass="${generator.jdbc.driver}"
                        connectionURL="${rator.jdbc.url}"
                        userId="${generator.jdbc.username}"
                        password="${generator.jdbc.password}"/>

        <!-- 实体类生成的位置 -->
        <javaModelGenerator targetPackage="org.micropay.dal.entity" targetProject="src/main/java">
            <property name="enableSubPackages" value="false"/>
            <property name="trimStrings" value="true"/>
        </javaModelGenerator>

        <!-- *Mapper.xml 文件的位置 -->
        <sqlMapGenerator targetPackage="org.micropay.dal.mapper" targetProject="src/main/resources">
            <property name="enableSubPackages" value="false"/>
        </sqlMapGenerator>

        <!-- Mapper 接口文件的位置 -->
        <javaClientGenerator targetPackage="org.micropay.dal.mapper" targetProject="src/main/java" type="XMLMAPPER">
            <property name="enableSubPackages" value="false"/>
        </javaClientGenerator>

自定义插件目录:图片说明

目前运行报错:
图片说明

请大神指教到底什么原因导致。

  • 写回答

2条回答 默认 最新

  • 关注

    可能是版本的问题吧,包括idea的版本

    评论

报告相同问题?

悬赏问题

  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试