mybatis-generator插件运行报错
generator.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> <!-- 配置文件,放在resource目录下即可 --> <!--数据库驱动个人配置--> <classPathEntry location="D:/mysql-connector-java-8.0.11.jar"/> <context id="MysqlTables" targetRuntime="MyBatis3"> <property name="autoDelimitKeywords" value="true"/> <!--可以使用``包括字段名,避免字段名与sql保留字冲突报错--> <property name="beginningDelimiter" value="`"/> <property name="endingDelimiter" value="`"/> <!-- optional,旨在创建class时,对注释进行控制 ,屏蔽注释信息--> <commentGenerator> <property name="suppressDate" value="true"/> <property name="suppressAllComments" value="true"/> </commentGenerator> <!--数据库链接地址账号密码--> <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver" connectionURL="jdbc:mysql://localhost:3306/spring_boot?useSSL=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true" userId="root" password="123456"> <property name="nullCatalogMeansCurrent" value="true"/> </jdbcConnection> <!-- 非必需,类型处理器,在数据库类型和java类型之间的转换控制,,控制是否强制DECIMAL和NUMERIC类型的字段转换为Java类型的java.math.BigDecimal,默认值为false,一般不需要配置。--> <javaTypeResolver> <property name="forceBigDecimals" value="false"/> </javaTypeResolver> <!--生成Model(实体)类存放位置--> <javaModelGenerator targetPackage="com.imooc.commerce.entity" targetProject="src/main/java"> <!-- 是否允许子包,即targetPackage.schemaName.tableName ..MBG会根据catalog和schema来生成子包--> <property name="enableSubPackages" value="true"/> <!-- 是否对类CHAR类型的列的数据进行trim操作 --> <property name="trimStrings" value="true"/> <!-- 建立的Model对象是否 不可改变 即生成的Model对象不会有 setter方法,只有构造方法 --> <property name="immutable" value="false"/> </javaModelGenerator> <!--生成mapper映射文件存放位置--> <sqlMapGenerator targetPackage="mappers" targetProject="src/main/resources"> <property name="enableSubPackages" value="true"/> </sqlMapGenerator> <!--生成Dao类存放位置--> <javaClientGenerator type="XMLMAPPER" targetPackage="com.imooc.commerce.dao" targetProject="src/main/java"> <property name="enableSubPackages" value="true"/> </javaClientGenerator> <!--生成对应表及类名--> <table schema="root" tableName="imooc_mall_cart" domainObjectName="Cart" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> <table tableName="imooc_mall_category" domainObjectName="Category" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> <table tableName="imooc_mall_order" domainObjectName="Order" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> <table tableName="imooc_mall_order_item" domainObjectName="OrderItem" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> <table tableName="imooc_mall_product" domainObjectName="Product" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> <table tableName="imooc_mall_user" domainObjectName="User" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"> </table> </context> </generatorConfiguration>
问题描述:
Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.7:generate (default-cli) on project commerce: configfile D:\JAVA工程文件\commerce\src\main\resources\generatorConfig.xml does not exist
39
收起
正在回答 回答被采纳积分+1
4回答
慕村4629685
2022-02-09 11:28:38
4.0.0org.springframework.bootspring-boot-starter-parent2.6.3com.imooccommerce0.0.1-SNAPSHOTcommerceDemo project for Spring Boot1.8org.springframework.bootspring-boot-starter-weborg.springframework.bootspring-boot-starter-testtestorg.mybatis.spring.bootmybatis-spring-boot-starter2.1.1mysqlmysql-connector-java8.0.11org.mybatis.generatormybatis-generator-core1.3.7org.springframework.bootspring-boot-maven-plugin2.6.3org.mybatis.generatormybatis-generator-maven-plugin1.3.7truetrue
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星