请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

mybatis-generator生成数据对象

最开始的报错:

Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project mmall: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate failed: Cannot resolve classpath entry: /g/Program/Java/JAVA_workSpace/mysql-connector-java-5.1.6-bin.jar -> [Help 1]

将classPathEntry location改为绝对路径之后报错:

Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2:generate (default-cli) on project mmall: Access denied for user 'root'@'113.250.152.4' (using password: YES) ->

各种尝试均无果。。。。希望各位能帮忙解决一下。

PS:在课程4.9中 我在git bash中无法使用 ll 命令(command not found),所以无法查看我是否下载了mysql-connector-java-5.1.6-bin.jar  于是自己去下载了一个

正在回答 回答被采纳积分+3

4回答

炎炎 2018-04-03 20:55:13

额。。成 功 了??!!该怎么说?迷之兼容性??这个问题看了好多帖子。。也试了菠萝的pom.xml文件,每次试也rebuild。。还是不行。。之后尝试新窗口直接导入老师的源代码,点自动生成dao层,尝试让它报重复生成表的接口的错误,不负所望,出现期望的错误,用源码的datasource.propertise和generatorConfig.xml替代自己创建的mmall_learning项目中相应的文件,竟然OK了

0 回复 有任何疑惑可以回复我~
炎炎 2018-04-03 19:40:59

我改成菠萝的pom.xml文件。。。但还是 Cannot resolve classpath entry: E:/IdeaProjects/mmall_learning/src/main/tool/mysql-connector-java-5.1.6-bin.jar"。。

C:\user\Java\jdk1.7.0_80\bin\java -Dmaven.home=C:\Users\software\apache-maven-3.0.5 -Dclassworlds.conf=C:\Users\software\apache-maven-3.0.5\bin\m2.conf "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.3.5\lib\idea_rt.jar=58471:C:\Program Files\JetBrains\IntelliJ IDEA 2017.3.5\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\software\apache-maven-3.0.5\boot\plexus-classworlds-2.4.jar org.codehaus.classworlds.Launcher -Didea.version=2017.3.5 org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate

[INFO] Scanning for projects...

[WARNING] 

[WARNING] Some problems were encountered while building the effective model for com:mmall:war:1.0-SNAPSHOT

[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 288, column 21

[WARNING] 

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING] 

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING] 

[INFO]                                                                         

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

[INFO] Building mmall Maven Webapp 1.0-SNAPSHOT

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

[INFO] 

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

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

[INFO] BUILD FAILURE

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

[INFO] Total time: 2.464s

[INFO] Finished at: Tue Apr 03 19:49:09 CST 2018

[INFO] Final Memory: 6M/108M

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

[ERROR] Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate (default-cli) on project mmall: Execution default-cli of goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.5:generate failed: Cannot resolve classpath entry: E:/IdeaProjects/mmall_learning/src/main/tool/mysql-connector-java-5.1.6-bin.jar" -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException


Process finished with exit code 1


0 回复 有任何疑惑可以回复我~
Geely 2018-03-24 13:20:20

你好,同学 路径不对吧?你是linux还是windows,windows的话盘符呢?

g:/这样写路径哟。

另外这里还提示了权限问题检查自己的账号密码是否正确。mysql是否开通了外部访问权限。

这个bin.jar包在项目的tools文件夹下是有的。同学可以看看哟。

【新加入的同学,以为内容请务必仔细阅读,给同学们整理的学习课程的集锦宝典,帮助大家更高效的完成一期课程】  
部署环境的话 ,建议看下文章最后一小段哟~首先跟着课程阿里云部署那个章节过一遍,可以先不跟着操作,做到心里有数,环境部署都做了什么。
http://coding.imooc.com/lesson/96.html#mid=3861   
课程项目思维导图及线上环境、测试环境、部署linux和windows等解答
http://www.imooc.com/article/20193  
尽快进入咱们QQ群哟~~进群方法下面思维导图那个帖子有。非常详细 
课程项目思维导图及线上环境、测试环境、部署linux和windows等解答
http://www.imooc.com/article/20193  
【重点】问答区常见问题整理
http://www.imooc.com/article/18998 
课程项目QQ群分享手记
http://www.imooc.com/article/19094 
找工作的季节之简历及找工作的分享
http://www.imooc.com/article/19998 
项目环境、vsftpd、linux、mysql等各种配置、软件下载
http://learning.happymmall.com 
mybatis-plugin插件安装
http://coding.imooc.com/learn/questiondetail/36007.html 
【二期进阶Tomcat集群和Redis分布式课程已经上线】
http://coding.imooc.com/class/162.html  
【最后祝同学,学完能感觉自己有提高,有收获,同学的支持也是我最大的动力!】


0 回复 有任何疑惑可以回复我~
polo哦 2018-03-20 22:43:40

pom里面的plugn换成我的哈

 <!-- mybatis逆向工程关键 -->

            <plugin>

                <groupId>org.mybatis.generator</groupId>

                <artifactId>mybatis-generator-maven-plugin</artifactId>

                <version>1.3.5</version>

                <configuration>

                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>

                    <overwrite>false</overwrite>

                    <verbose>true</verbose>

                </configuration>

                <dependencies>

                    <dependency>

                        <groupId>mysql</groupId>

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

                        <version>5.1.41</version>

                    </dependency>

                </dependencies>

            </plugin>


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信