为了账号安全,请及时绑定邮箱和手机立即绑定

运行 mybatis generator 出错

[INFO] 

[INFO] ---------------------< com.miaoshaproject:miaosha >---------------------

[INFO] Building miaosha 1.0-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO] 

[INFO] --- mybatis-generator-maven-plugin:1.3.5:generate (default-cli) @ miaosha ---

[INFO] Connecting to the Database



xml
<?xml version="1.0" encoding="UTF-8"?>
        <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
                "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">


<generatorConfiguration>
<!--    <classPathEntry location="/Program Files/IBM/SQLLIB/java/db2java.zip" />-->

    <context id="DB2Tables" targetRuntime="MyBatis3">
        <jdbcConnection driverClass="com.mysql.jdbc.Driver"
                        connectionURL=" jdbc:mysql://127.0.0.1:3306/miaosha"
                        userId="root"
                        password="mysql">
        </jdbcConnection>

        <javaTypeResolver >
            <property name="forceBigDecimals" value="false" />
        </javaTypeResolver>
<!--生成Dataobject-->
        <javaModelGenerator targetPackage="com.miaoshaproject.dataobject" targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
            <property name="trimStrings" value="true" />
        </javaModelGenerator>

        <sqlMapGenerator targetPackage="mapping"  targetProject="src/main/resources">
            <property name="enableSubPackages" value="true" />
        </sqlMapGenerator>

        <javaClientGenerator type="XMLMAPPER" targetPackage="com.miaoshaproject.dao"  targetProject="src/main/java">
            <property name="enableSubPackages" value="true" />
        </javaClientGenerator>

        <table schema="DB2ADMIN" tableName="user_info" domainObjectName="UserDo" >
<!--            <property name="useActualColumnNames" value="true"/>-->
<!--            <generatedKey column="ID" sqlStatement="DB2" identity="true" />-->
<!--            <columnOverride column="DATE_FIELD" property="startDate" />-->
<!--            <ignoreColumn column="FRED" />-->
<!--            <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />-->
        </table>
        <table schema="DB2ADMIN" tableName="user_password" domainObjectName="UserPasswordDo" >
            <!--            <property name="useActualColumnNames" value="true"/>-->
            <!--            <generatedKey column="ID" sqlStatement="DB2" identity="true" />-->
            <!--            <columnOverride column="DATE_FIELD" property="startDate" />-->
            <!--            <ignoreColumn column="FRED" />-->
            <!--            <columnOverride column="LONG_VARCHAR_FIELD" jdbcType="VARCHAR" />-->
        </table>

    </context>
</generatorConfiguration>

pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.11</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.miaoshaproject</groupId>
    <artifactId>miaosha</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>tk.mybatis</groupId>
            <artifactId>mapper-weekend</artifactId>
            <version>1.1.5</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.2.2</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
                <scope>8.0.25</scope>
        </dependency>


        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.2.8</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin><groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.5</version>
                <dependencies>
                    <dependency>
                        <groupId>org.mybatis.generator</groupId>
                        <artifactId>mybatis-generator-core</artifactId>
                        <version>1.3.5</version>
                    </dependency>


                </dependencies>
                                         <executions>
                                                    <execution>
                                        <id>mybatis generator</id>
                                      <phase>package</phase>
                      <goals>
                                             <goal>generate</goal>
                                             </goals>
                    </execution>
                </executions>
                <configuration>
<!--                    允许移动生成的文件-->
                    <verbose>true</verbose>
<!--                    允许自动覆盖-->
                    <overwrite>true</overwrite>
                    <configurationFile>
                        src/main/resources/mybatis-generator.xml
                    </configurationFile>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

            <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
            <java.version>1.8</java.version>

    </properties>

</project>


正在回答

举报

0/150
提交
取消
SpringBoot构建电商基础秒杀项目
  • 参与学习       46318    人
  • 解答问题       943    个

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

进入课程

运行 mybatis generator 出错

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信