1. 程式人生 > >application.yml使用@符合問題:'@' that cannot start any token. (Do not use @ for indentation)

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

The exce 配置 reader cat .so not 文件 uil

在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@‘

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