I have created a library that upon an annotation it automatically generates a mapper, the DTO and other stuff. The code that’s generated is
package it.dookly.dooklybackend.category.dto;
import it.dookly.springenhancedcrudcontrollers.dto.crud.CrudDto;
import java.lang.Integer;
import java.lang.String;
import lombok.Data;
@Data
public class CategoryDto implements CrudDto {
private Integer id;
private String name;
}
package it.dookly.dooklybackend.category.mappers;
import it.dookly.dooklybackend.category.dto.CategoryDto;
import it.dookly.dooklybackend.category.entities.Category;
import it.dookly.springenhancedcrudcontrollers.mappers.EntityDtoMapper;
import org.mapstruct.Mapper;
import org.springframework.stereotype.Component;
@Component
@Mapper(
componentModel = "spring"
)
public interface CategoryMapper extends EntityDtoMapper<Category, CategoryDto> {
}
But when it tries to create the implementation of the mapper it gives me the warning warning: Unmapped target properties: "id, name". Occured at 'ENTITY toEntity(DTO dto)' in 'EntityDtoMapper'.
and it creates a non functioning mapper implementation class.
When I put the Dto in the src/main
everything works great and I don’t receive any error, so I think the error might be that MapStruct does not fully recognize the Dto.
I have tried putting this in build.gradle
but nothing changed
sourceSets {
main {
java {
srcDirs = ['src/main/java', 'build/generated/sources/annotationProcessor/java/main']
}
}
}
What could I try next? Thanks!