• springboot(十三):springboot结合mybatis generator逆向工程自动生成代码


    错信息generate failed: Exception getting JDBC Driver: com.mysql.jdbc.Driver

      上网查了一下,发现原来是generator这个插件在运行的时候找不到com.mysql.jdbc.Driver的依赖,把pom文件中的这个依赖移到generator中去即可。
      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.1.2.RELEASE</version>
            <relativePath/> <!-- lookup parent from repository -->
        </parent>
        <groupId>com.bitauto.oa</groupId>
        <artifactId>oa-generator</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>oa-generator</name>
        <description>Demo project for Spring Boot</description>
    
        <properties>
            <java.version>1.8</java.version>
        </properties>
    
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.mybatis.spring.boot</groupId>
                <artifactId>mybatis-spring-boot-starter</artifactId>
                <version>1.3.2</version>
            </dependency>
    
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <scope>runtime</scope>
            </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.2</version>
                    <configuration>
                        <verbose>true</verbose>
                        <overwrite>true</overwrite>
                        <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
                    </configuration>
                    <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.28</version>
                        <scope>runtime</scope>
                    </dependency>
                    </dependencies>
                </plugin>
    
            </plugins>
        </build>
    
    </project>
    View Code

    mybatis.generator配上最新的mysql 8.0.11的一些坑

     https://blog.csdn.net/qq_37350706/article/details/81429154

    https://blog.csdn.net/yeyazhishang/article/details/80816130

  • 相关阅读:
    ELK原理以及一些处理难点分析
    mysql无法启动,Error: page 13476 log sequence number
    Linux lsattr命令
    mysql主从复制案例及小结
    Nagios
    iptables路由转发及控制
    DNS域名解析
    无法启动Print Spooler服务,错误代码1068,依赖服务或组件
    云计算虚拟化知识
    文件上传漏洞
  • 原文地址:https://www.cnblogs.com/cnki/p/10291204.html
Copyright © 2020-2023  润新知