yml使用@符合問題:'@' that cannot start any token. (Do not use @ for indentation)


轉至 https://www.cnblogs.com/liaojie970/p/9007896.html#undefined

在application配置文件中使用@出現異常:

Exception in thread "main" while scanning for the next token
found character '@' that cannot start any token. (Do not use @ for indentation)
 in 'reader', line 4, column 11:
        name: @project.artifactId@

代碼:

復制代碼
info:
  app:
    name: @project.artifactId@
    encoding: @project.build.sourceEncoding@
    java:
      source: @java.version@
      target: @java.version@
復制代碼

解決方案,用單引號或雙引號將@@之間的內容包起來:

復制代碼
info:
  app:
    name: "@project.artifactId@"
    encoding: '@project.build.sourceEncoding@'
    java:
      source: '@java.version@'
      target: '@java.version@'
復制代碼


免責聲明!

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



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