maven配置报错:while scanning for the next token found character ‘@‘

问题现象

spring:
  profiles:
    active: @activeProfile@

解决方案

  • 配置POM

        <build>
            <resources>
                <resource>
                    <directory>src/main/resources</directory>
                    <!--开启过滤,用指定的参数替换directory下的文件中的参数-->
                    <filtering>true</filtering>
                </resource>
            </resources>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring-boot.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>repackage</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>