SpringCloud报错while scanning for the next token found character ‘@‘ that cannot start any token

spring-cloud报错

在多模块开发的微服务系统中,报错 while scanning for the next token found character ‘@’ that cannot start any token 解决方法
遇到报错,很头痛,百度和google了很久没有找到解决方案

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 5, column 13:
        active: @profileActive@

SpringCloud报错while scanning for the next token found character ‘@‘ that cannot start any token_第1张图片

下面是我自己的解决方案,亲测有效,但是不知道对你的错误是否有效,可以试一下

  • 第一种(在pom文件中添加一个依赖):
		<dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
        </dependency>
  • 第二种(在构建项目的时候,build一下resource文件,也是在pom文件,在build节点添加内容,这个是项目基本都需要加的,但是我忘了加,导致研究了很久)
 <!--build节点增加内容-->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <!--开启过滤,用指定的参数替换directory下的文件中的参数-->
                <filtering>true</filtering>
            </resource>
        </resources>

总结

这两种方法都尝试一下,我的建议呢,是都加上,如果还不行,google上给的建议也有 mvn clean compile 、mvn clean install等,但是我试了没用,你们遇到了也可以尝试一下

如果大家遇到这种问题解决了,希望大家可以在下面踊跃发言,一起学习一下

你可能感兴趣的:(spring,cloud)