Spring Boot 使用maven打包替换变量resource、filtering

    xiaoxiao2021-03-25  134

    Spring Boot 使用maven打包替换变量resource、filtering【rsl】

    总结:使用【@变量@】代替【${变量}】

    --------------------------------------------------------------------------------------------

    pom:

       ......

       <parent>

            <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-parent</artifactId>         <version>1.4.2.RELEASE</version>     </parent>         <properties>           <app.name>training</app.name>           <myName>rsl</myName>         </properties>         <build>         <resources>                <resource>                  <directory>src/main/resources</directory>                    <!-- rsl是否替换资源中的属性rsl-->                    <filtering>true</filtering>                </resource>                      </resources>

          </build>

       ......

    --------------------------

    资源:

    name=@myName@ app.name=${app.name} app.name=@app.name@ ----- 编译: mvn clean compile

    结果: name=rsl app.name=${app.name} app.name=training

    转载请注明原文地址: https://ju.6miu.com/read-10192.html

    最新回复(0)