maven在春天不显示颜色

我在执行测试时尝试显示颜色,但它不适用于 spring 2

我试过了

spring.output.ansi.enabled=always

还是一样的结果。

我试过这个网站:

在 Spring Boot 测试控制台日志中启用颜色

但只得到“黑白”,颜色永远不会出现

我有 maven 3.5.2 和 spring/boot 2

unitest 结果:  

springboot 测试结果: 


千巷猫影
浏览 160回答 2
2回答

呼啦一阵风

你的 pom.xml 配置是什么。取决于您使用哪个组/工件来运行mvn verify.我正在使用org.codehaus.mojo,但我永远无法让它工作,我切换到 org.springframework.boot/spring-boot-maven-plugin 它对我有用。试试这个配置,然后再试一次:<plugin>&nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; <artifactId>spring-boot-maven-plugin</artifactId>&nbsp; &nbsp; <executions>&nbsp; &nbsp; &nbsp; &nbsp; <execution>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <id>pre-integration-test</id>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <goals>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <goal>start</goal>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </goals>&nbsp; &nbsp; &nbsp; &nbsp; </execution>&nbsp; &nbsp; &nbsp; &nbsp; <execution>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <id>post-integration-test</id>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <goals>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <goal>stop</goal>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </goals>&nbsp; &nbsp; &nbsp; &nbsp; </execution>&nbsp; &nbsp; </executions></plugin>编辑: 此外,请确保您拥有:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <plugin>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.springframework.boot</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>spring-boot-maven-plugin</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </plugin>

catspeake

因为这可能是因为区分大小写,所以总是像下面这样更改为大写。spring.output.ansi.enabled=总是
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java