首页 > IT职业 > IT生活 > maven 分环境打包
src/build-config/build-develop.properties
src/build-config/build-product.properties
src/build-config/build-test.properties
build-develop.properties
#数据库配置
build.jdbc.url = jdbc:oracle:thin:@ip:port:database
build.jdbc.username = name
build.jdbc.password = pwd
build.jdbc.driverClassName = oracle.jdbc.driver.OracleDriver
jdbc.properties
#数据库地址
jdbc.url = @build.jdbc.url@
#数据库用户名
jdbc.username = @build.jdbc.username@
#数据库密码
jdbc.password = @build.jdbc.password@
#数据库驱动
jdbc.driverClassName = @build.jdbc.driverClassName@
<properties> <resource.delimiter>@</resource.delimiter></properties>
<!-- 分环境配置 --><profiles> <profile> <id>develop</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <project.env>develop</project.env> </properties> </profile> <profile> <id>product</id> <properties> <project.env>product</project.env> </properties> </profile> <profile> <id>test</id> <properties> <project.env>test</project.env> </properties> </profile></profiles><build> <!-- 分环境过滤器 --> <filters> <filter>build-config/build-${project.env}.properties</filter> </filters> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.xml</include> </includes> <!-- 是否分环境过滤 --> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.xml</include> <include>**/*.properties</include> </includes> <!-- 是否分环境过滤 --> <filtering>true</filtering> </resource> </resources></build>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4003/viewspace-2816997/ ,如需转载,请注明出处,否则将追究法律责任。