# properties-maven-plugin **Repository Path**: amtech/properties-maven-plugin ## Basic Information - **Project Name**: properties-maven-plugin - **Description**: 架构必备 - 多工程属性文件统一管理(创建,替换)Maven插件, 数据来源支持 文件和数据库两种方式 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 15 - **Created**: 2023-03-28 - **Last Updated**: 2023-03-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## properties-maven-plugin properties-maven-plugin是一个maven插件,致力于提高开发效率,降低配置出错的概率。 ## 简单描述 插件出发点:单工程多环境配置(如:jdbc),多工程多环境配置 存在的问题: 1 项目中存在大量重复的配置信息(常见的有properties文件中); 2 开发也好部署也好,一不小心忘记修改一个值,直接导致正式环境异常重来 3 想要查询某一配置都应用于哪些项目困难 本插件解决了以上所有问题,发挥想象可以实现更多功能 描述: 配置信息可以不配置到工程中了,可以从电脑中的某一路径或文件,也可以从数据库中获取 支持多级继承 如果现在数据库中已有字典表或系统参数表,就可以支持使用,相当方便 ## Quick Start ```xml com.dplugin.maven.plugins properties-maven-plugin 1.0.0 ... ... ``` ## maven命令 ```shell mvn properties:create mvn properties:replace ``` ## dependencies 如果要使用数据库,需要指定驱动依赖,如下 mysql: ```xml mysql mysql-connector-java 5.1.18 ``` ## configuration 普通配置项: ```xml false UTF-8 . @ false true false ... ``` 数据源(文件或数据库): ```xml ${basedir}/src/main/**/demo.properties jdbc:mysql://localhost:3306/system?useUnicode=true&characterEncoding=utf-8 root root 0 select id from t1 where pid=? and pack=? select id,title,`key`,value from t2 where tid=? ... ``` 生成文件规则配置: ```xml true src/main/resources/jdbc.properties common.project.jdbc.test.person ``` 替换文件中的属性规则配置(强烈建议只替换编译过后的文件,除properties文件,其它文件替换后不可逆): ```xml true common.project.jdbc.test.person src/main/**/*.properties src/main/**/*.xml ```