[JAVA] Maven profiles control multi-environment data source log packaging

Uncle Cthulhu 2022-11-24 21:24:48 阅读数:979

javamavenprofilescontrolmulti-environment

1. First, the multi-environment folder:

database.properties:

jdbc.driverClassName=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://*.*.*.*:3306/*?useSSL=falsejdbc.username=***jdbc.password=***

2. pom.xml configuration:

 testresource_testfalseproresource_profalseprocureorg.apache.maven.pluginsmaven-compiler-plugin1.81.8utf-8${basedir}/src/main/resources/*.***/*.xml**/*.propertiestrue${basedir}/src/main/resources/${env}*.***/*.xml**/*.propertiestrue

3. Second data source configuration:

 …

4. Pack again: (you must clean first, because you replaced the xml file~~)

The logback log only needs to modify the log path; (refer to another blog for the specific logback log)

copyright:author[Uncle Cthulhu],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/328/202211242120378840.html