개발/일지

[오류] mvnw package 중 오류 - formatting

Zziny 2022. 12. 24. 07:16

오류 메시지

[ERROR] Failed to execute goal io.spring.javaformat:spring-javaformat-maven-plugin:0.0.31:validate (default) on project spring-petclinic: Formatting violations found in the following files:
[ERROR]  * D:\chloe\spring-petclinic\src\main\java\org\springframework\samples\petclinic\model\Person.java
[ERROR]  * D:\chloe\spring-petclinic\src\main\java\org\springframework\samples\petclinic\owner\Owner.java
[ERROR]  * D:\chloe\spring-petclinic\src\main\java\org\springframework\samples\petclinic\owner\OwnerController.java
[ERROR]  * D:\chloe\spring-petclinic\src\main\java\org\springframework\samples\petclinic\owner\OwnerRepository.java
[ERROR]  * D:\chloe\spring-petclinic\src\test\java\org\springframework\samples\petclinic\owner\OwnerControllerTests.java
[ERROR]
[ERROR] Run `spring-javaformat:apply` to fix.

원인

읽어보면 Formatting violations found in the following files: 라고 써 있다.

Formatting 문제였다. 

아래를 참고하자!

Spring Java Format
What is This?
A set of plugins that can be applied to any Java project to provide a consistent “Spring” style. The set currently consists of:A source formatter that applies wrapping and whitespace conventionsA checkstyle plugin that enforces consistency across a codebaseSince the aim of this project is to provide consistency, each plugin is not generally configurable. You need to change your code to match the required conventions. You can’t configure the plugin conventions to match your style!

<참고: https://github.com/spring-io/spring-javaformat#spring-java-format>

처리

cmd 창에서 mvnw spring-javaformat:apply 적용