springboot + screw数据库文档生成 pom方式

本文介绍了一种利用Screw工具自动生成数据库文档的方法,通过Maven插件配置,能够从数据库读取元数据并生成HTML格式的文档,简化了数据库文档的创建过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

偶然的机会在github上看到了screw这个数据库文档生成工具,个人感觉还挺不错的,做个记录吧

screw

pom

<build>
    <plugins>
		<!-- pom文件读取yml配置插件 -->
        <plugin>
            <groupId>it.ozimov</groupId>
            <artifactId>yaml-properties-maven-plugin</artifactId>
            <version>1.1.3</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>src/main/resources/application.yml</file>
                        </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>
		
		<!-- 文档生成插件 -->
        <plugin>
            <groupId>cn.smallbun.screw</groupId>
            <artifactId>screw-maven-plugin</artifactId>
            <version>${lastVersion}</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>${spring.datasource.username}</username>
                <!--password-->
                <password>${spring.datasource.password}</password>
                <!--driver-->
                <driverClassName>${spring.datasource.driverClassName}</driverClassName>
                <!--jdbc url-->
                <jdbcUrl>${spring.datasource.url}</jdbcUrl>
                <!--生成文件类型-->
                <fileType>HTML</fileType>
                <!--打开文件输出目录-->
                <openOutputDir>false</openOutputDir>
                <!--生成模板-->
                <produceType>freemarker</produceType>
                <!--文档名称 为空时:将采用[数据库名称-描述-版本号]作为文档名称-->
                <fileName>测试文档名称</fileName>
                <!--描述-->
                <description>数据库文档生成</description>
                <!--版本-->
                <version>${project.version}</version>
                <!--标题-->
                <title>数据库文档</title>
            </configuration>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

编译生成文档(使用的是IDEA)

双击compile
在这里插入图片描述

效果图

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值