Idea自动生成Mybatis代码报错: Cannot resolve classpath entry: D:\src\main\java -> [Help 1

_Ricky_ 2017-09-25 11:45:13
一上午了,怎么改路径都是报“ D:\src\main\java”,我故意写错的路径也没有,要疯了,求大牛解答

报错信息
[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate failed: Cannot resolve classpath entry: D:\src\main\java -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project springboot: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate failed: Cannot resolve classpath entry: D:\src\main\java


配置信息

<?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>
<properties resource="application.properties"></properties>
<!-- 数据库JDBC驱动jar包 -->
<classPathEntry location="C:\Program Files (x86)\Java\mysql-connector-java-5.1.26-bin.jar"/>

<!-- 指定运行环境是mybatis3的版本 -->
<context id="testTables" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否取消注释 -->
<property name="suppressAllComments" value="true" />
<!-- 是否生成注释代时间戳 -->
<property name="suppressDate" value="false" />
</commentGenerator>

<!-- jdbc 连接信息 -->
<jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://localhost:3306/ugg001"
userId="root"
password="root">
</jdbcConnection>

<!-- javabean配置信息 targetProject:自动生成实体类对象的位置-->
<javaModelGenerator targetPackage="com.example.entity" targetProject="\src\main\java">
<!-- 去除字段前后空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- 指定Mapper文件生成在哪个包 -->
<sqlMapGenerator targetPackage="mybatis" targetProject="src/main/resources" />
<!-- dao接口放在哪里 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="com.example.mapper" targetProject="src/main/java" />

<!-- 配置表对应的javabean信息 -->
<table tableName="u_user" domainObjectName="UUser"></table>
<table tableName="u_user_role" domainObjectName="UserRole"></table>
<table tableName="u_permission" domainObjectName="Permission"></table>
<table tableName="u_role" domainObjectName="URole"></table>
<table tableName="u_role_permission" domainObjectName="RolePermission"></table>

</context>
</generatorConfiguration>


项目路径


在线等!急
...全文
2833 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
平庸的俗人 2020-03-11
  • 打赏
  • 举报
回复
在前面 加上 ${basedir}
AOP_LIU 2019-07-14
  • 打赏
  • 举报
回复
我也是这个问题,整到了晚上10点才解决;
错误提示:
Cannot resolve classpath entry: /d/idea/projects/mmall/mysql-connector-java

正确路径:/IDEA/Projects/mmall/mysql-connector-java-5.1.6-bin.jar
根据网上报错提示,我最终解决的方法是去掉盘符(/d)

希望能够给后边遇到类似错误的有所帮助。
qq_29643479 2017-10-27
  • 打赏
  • 举报
回复
table 里加 <generatedKey column="id" sqlStatement="JDBC" identity="true" />试试
_Ricky_ 2017-09-25
  • 打赏
  • 举报
回复

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧