maven多環境IDEA啟動報Do not use @ for indentation錯誤解決方法


maven多環境配置如下:

<profiles>
        <profile>
            <!--開發環境-->
            <id>dev</id>
            <properties>
                <profileActive>dev</profileActive>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <!--測試環境-->
            <id>test</id>
            <properties>
                <profileActive>test</profileActive>
            </properties>
        </profile>
        <profile>
            <!--正式環境-->
            <id>prod</id>
            <properties>
                <profileActive>prod</profileActive>
            </properties>
        </profile>
</profiles>

application.yml使用如下:

spring:
  profiles:
    active: @profileActive@

報錯如下:

Caused by: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
 in 'reader', line 19, column 13:
        active: @profileActive@

解決方案如下:

<!--build節點增加內容-->
<resources>
        <resource>
                <directory>src/main/resources</directory>
                <!--開啟過濾,用指定的參數替換directory下的文件中的參數-->
                <filtering>true</filtering>
        </resource>
</resources>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM