如何使用screw一键生成数据库文档

这篇文章主要讲解了“如何使用screw一键生成数据库文档”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“如何使用screw一键生成数据库文档”吧!

一. screw的配置
  1. 配置pom文件

<?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 https://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.2.9.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.bee</groupId>
  <artifactId>screw-demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>screw-demo</name>
  <description>Screw Demo for Spring Boot</description>

  <properties>
    <java.version>1.8</java.version>
  </properties>

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

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>cn.smallbun.screw</groupId>
      <artifactId>screw-core</artifactId>
      <version>1.0.4</version>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>cn.smallbun.screw</groupId>
        <artifactId>screw-maven-plugin</artifactId>
        <version>1.0.4</version>
        <dependencies>
          <!-- HikariCP -->
          <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
            <version>3.4.5</version>
          </dependency>
          <!--mysql driver -->
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.20</version>
          </dependency>
        </dependencies>
        <configuration>
          <!--username -->
          <username>root</username>
          <!--password -->
          <password>123456</password>
          <!--driver -->
          <driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>
          <!--jdbc url -->
          <jdbcUrl>jdbc:mysql://localhost:3306/db_mybatis</jdbcUrl>
          <!--生成文件类型 -->
          <fileType>HTML</fileType>
          <!--打开文件输出目录 -->
          <openOutputDir>false</openOutputDir>
          <!--生成模板 -->
          <produceType>freemarker</produceType>
          <!--描述 -->
          <description>数据库文档生成</description>
          <!--版本 -->
          <version>1.0.0</version>
          <!--标题 -->
          <title>数据库文档</title>
        </configuration>
        <executions>
          <execution>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
  1. 配置数据源
    src/main/resources/application.properties

spring.datasource.url=jdbc:mysql://localhost:3306/db_mybatis?useUnicode=true&characterEncoding=UTF-8&useSSL=false
spring.datasource.usename=root
spring.datasource.password=123456
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.xa.properties.useInformationSchema=true
二. 通过Maven插件运行screw
  1. IDEA中运行

  2. 如何使用screw一键生成数据库文档  screw 第1张

  3. Eclipse中运行

  • 处理POM配置文件中的错误(也可以不管这个错误,直接运行)

  • 如何使用screw一键生成数据库文档  screw 第2张


  • 如何使用screw一键生成数据库文档  screw 第3张


  • 如何使用screw一键生成数据库文档  screw 第4张


  • 运行

  • 如何使用screw一键生成数据库文档  screw 第5张


  • 如何使用screw一键生成数据库文档  screw 第6张

  • 在Goals中输入:screw:run

三. 生成数据库各表的设计文档

如何使用screw一键生成数据库文档  screw 第7张

感谢各位的阅读,以上就是“如何使用screw一键生成数据库文档”的内容了,经过本文的学习后,相信大家对如何使用screw一键生成数据库文档这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是蜗牛博客,小编将为大家推送更多相关知识点的文章,欢迎关注!

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:niceseo99@gmail.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论电报频道链接