当前位置:   article > 正文

pom多环境配置_pom文件版本号取配置

pom文件版本号取配置

配置pom.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <groupId>test</groupId>
  6. <artifactId>test6</artifactId>
  7. <version>1.0-SNAPSHOT</version>
  8. <packaging>war</packaging>
  9. <name>test6 Maven Webapp</name>
  10. <!-- FIXME change it to the project's website -->
  11. <url>http://www.example.com</url>
  12. <properties>
  13. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  14. <maven.compiler.source>1.7</maven.compiler.source>
  15. <maven.compiler.target>1.7</maven.compiler.target>
  16. </properties>
  17. <profiles>
  18. <profile>
  19. <id>dev</id>
  20. <activation>
  21. <activeByDefault>true</activeByDefault>
  22. </activation>
  23. <properties>
  24. <profiles.active>dev</profiles.active>
  25. </properties>
  26. </profile>
  27. <profile>
  28. <id>pro</id>
  29. <properties>
  30. <profiles.active>pro</profiles.active>
  31. </properties>
  32. </profile>
  33. <profile>
  34. <id>test</id>
  35. <properties>
  36. <config>test</config>
  37. </properties>
  38. </profile>
  39. </profiles>
  40. <build>
  41. <finalName>${project.artifactId}</finalName>
  42. <resources>
  43. <resource>
  44. <directory>src/main/resources/config</directory>
  45. <!--
  46. exclude可以排除指定文件,支持通配符 ,匹配项不会生成到classes目录下,路径是以directory开始的
  47. 在这里就是directory(src/main/resources/)/properties/env/pro.properties
  48. -->
  49. <excludes>
  50. <exclude>test/*</exclude>
  51. <exclude>pro/*</exclude>
  52. <exclude>dev/*</exclude>
  53. </excludes>
  54. <filtering>true</filtering>
  55. </resource>
  56. </resources>
  57. </build>
  58. </project>

配置properties文件

1.application.properties

2.dev.properties

3.pro.properties

4.test.properties

配置application.properties

p_datasources=${datasources}
p_port=${port}
p_name=${name}
p_password=${password}

配置dev/test/pro.properties

datasources=dev
port=1521
name=test
password=123

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/995804
推荐阅读
相关标签
  

闽ICP备14008679号