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@'
复制代码

posted on 2018-12-20 16:13  黄俊杰  阅读(1742)  评论(0)    收藏  举报

导航