yml、properties获取pom自定义变量

pom变量:


    
        
        dev
        
            dev
            jdbc:mysql://127.0.0.1:3306/melab?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
            jdbc:mysql://127.0.0.1:3306/tx-manager?allowMultiQueries=true&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
            root
            123456
        
    

yml获取pom变量:

添加依赖:



    org.yaml
    snakeyaml
    1.25

获取变量:

url: @jdbc-url@
lcn-log-url: @jdbc-url@
username: @jdbc-user@
password: @jdbc-password@

properties获取pom变量:

build设置:


    
    
        
            
                maven-resources-plugin
                
                    utf-8
                    true
                
            
        
    


获取变量:

spring.datasource.url=${jdbc-url}
spring.datasource.username=${jdbc-user}
spring.datasource.password=${jdbc-password}

你可能感兴趣的:(spring,cloud,maven)