mybatis-generator-plugin icon indicating copy to clipboard operation
mybatis-generator-plugin copied to clipboard

Not working via try to eclipse plugin

Open Ranbowong opened this issue 4 years ago • 1 comments

I installed the mybatis generator plugin in Eclipse, the release information of eclipse listed as below: Eclipse IDE for Enterprise Java Developers. Version: 2020-03 (4.15.0) Build id: 20200313-1211

Plugin details as below : MyBatis Generator 1.4.0.201911242214 org.mybatis.generator.feature.group mybatis.org

OS information : Ubuntu 20.04 x64

Maven dependencies and plugins as below:

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-json</artifactId>
    </dependency>
    
    
    <dependency>
        <groupId>tk.mybatis</groupId>
        <artifactId>mapper</artifactId>
        <version>4.0.3</version>
    </dependency>

    <dependency>
        <groupId>org.mybatis.spring.boot</groupId>
        <artifactId>mybatis-spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>com.github.pagehelper</groupId>
        <artifactId>pagehelper-spring-boot-starter</artifactId>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
    </dependency>

</dependencies>


<build>
    <plugins>
        <plugin>
            <groupId>org.mybatis.generator</groupId>
            <artifactId>mybatis-generator-maven-plugin</artifactId>
            <version>1.3.7</version>
            <configuration>
                <configurationFile>
                    mybatis-generator/generatorConfig.xml
                </configurationFile>
                <overwrite>true</overwrite>
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>8.0.16</version>
                </dependency>
                <dependency>
                    <groupId>com.itfsw</groupId>
                    <artifactId>mybatis-generator-plugin</artifactId>
                   <!--  <version>1.3.2</version> -->
                    <version>1.4.0</version>
                </dependency>
            </dependencies>
        </plugin>

    </plugins>

</build>

The configuration for the plugin is: <context id="mysqlgenerator" targetRuntime="MyBatis3">

    <commentGenerator>
        <property name="suppressDate" value="true"/>
    </commentGenerator>

I got the error message : generatorConfig.xml.xml:5: java.lang.RuntimeException: Cannot instantiate object of type com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin java.lang.RuntimeException: Cannot instantiate object of type com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin

And the generator hung up.

Can you please advise?

Ranbowong avatar Jul 04 '21 15:07 Ranbowong

    <!-- 自动生成toString方法 -->
    <plugin type="org.mybatis.generator.plugins.ToStringPlugin"/>
    <!-- 自动生成equals方法和hashcode方法 -->
    <plugin type="org.mybatis.generator.plugins.EqualsHashCodePlugin"/>

    <!-- 非官方插件 https://github.com/itfsw/mybatis-generator-plugin -->
    <!-- 查询单条数据插件 -->
    <plugin type="com.itfsw.mybatis.generator.plugins.SelectOneByExamplePlugin"/>
    <!-- 查询结果选择性返回插件 -->
    <plugin type="com.itfsw.mybatis.generator.plugins.SelectSelectivePlugin"/>
    <!-- Example Criteria 增强插件 -->
    <plugin type="com.itfsw.mybatis.generator.plugins.ExampleEnhancedPlugin"/>
    <!-- 数据Model属性对应Column获取插件 -->
    <plugin type="com.itfsw.mybatis.generator.plugins.ModelColumnPlugin"/>
    <!-- 逻辑删除插件 -->
    <plugin type="com.itfsw.mybatis.generator.plugins.LogicalDeletePlugin">
        <!-- 这里配置的是全局逻辑删除列和逻辑删除值,当然在table中配置的值会覆盖该全局配置 -->
        <!-- 逻辑删除列类型只能为数字、字符串或者布尔类型 -->
        <property name="logicalDeleteColumn" value="deleted"/>
        <!-- 逻辑删除-已删除值 -->
        <property name="logicalDeleteValue" value="1"/>
        <!-- 逻辑删除-未删除值 -->
        <property name="logicalUnDeleteValue" value="0"/>
    </plugin>

    <commentGenerator>
        <property name="suppressDate" value="true"/>
        <!--<property name="suppressAllComments" value="true"/>-->
    </commentGenerator>
</context>
is the configure file's major contents

Ranbowong avatar Jul 04 '21 15:07 Ranbowong