Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MapStruct maven plugin warnings #157

Closed
arey opened this issue Sep 21, 2024 · 1 comment
Closed

Fix MapStruct maven plugin warnings #157

arey opened this issue Sep 21, 2024 · 1 comment

Comments

@arey
Copy link
Member

arey commented Sep 21, 2024

There are some unmapped target properties:


[INFO] Compiling 112 source files with javac [debug parameters release 17] to target/classes
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/PetTypeMapper.java:[19,13] Unmapped target property: "id".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/VetMapper.java:[17,9] Unmapped target property: "id".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/VisitMapper.java:[16,11] Unmapped target property: "pet".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/VisitMapper.java:[18,11] Unmapped target properties: "id, pet".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java:[20,12] Unmapped target property: "petId". Mapping from Collection element "Visit visits" to "VisitDto visits".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java:[26,9] Unmapped target property: "pet". Mapping from Collection element "VisitDto visits" to "Visit visits".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java:[26,9] Unmapped target property: "owner".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/PetMapper.java:[28,9] Unmapped target properties: "id, owner, visits".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/OwnerMapper.java:[21,11] Unmapped target properties: "id, pets".
[WARNING] /Users/arey/Dev/GitHub/spring-petclinic/spring-petclinic-rest/src/main/java/org/springframework/samples/petclinic/mapper/UserMapper.java:[16,10] Unmapped target properties: "id, user".
[INFO] 
@joaobertholino
Copy link
Contributor

joaobertholino commented Oct 16, 2024

Hello, how are you?
I'm new here, I took a look at this issue #157, and I verified that the cause of the warnings is due to the fact that the object received as an argument does not have the attributes indicated as "not mapped" in the log message, thus resulting in a warning.

If the lack of these attributes is intentional, one way to hide these warnings in the log would be to implement a specific reporting policy to ignore attributes not mapped by MapStruct.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants