Mapstruct generated class only contains the compile error information. #3812
Replies: 3 comments 3 replies
-
|
Hi @liudongqing Can you provide a github project with a reproducer? Haven't seen something like this before. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
|
I also have this problem,But it appears randomly.In my case,i found the "target/generated-sources" directory have the right mapstrcut mapper interface implement ,but the classes directory xxxMapperImpl.class show compile errors like below: @Component
public class SentenceVariantMapperImpl {
public SentenceVariantMapperImpl() {
throw new Error("Unresolved compilation problems: \n\tThe import com.englishlearning.application.content.dto.SentenceVariantDTO cannot be resolved\n\tSentenceVariantMapper cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTO(SentenceVariant) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTOList(List<SentenceVariant>) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTO(SentenceVariant) from the type SentenceVariantMapperImpl refers to the missing type SentenceVariantDTO\n\tThe method toEntityList(List<SentenceVariantDTO>) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n");
}
public SentenceVariantDTO toDTO(SentenceVariant entity) {
throw new Error("Unresolved compilation problems: \n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTO(SentenceVariant) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved\n");
}
public SentenceVariant toEntity(SentenceVariantDTO dto) {
throw new Error("Unresolved compilation problem: \n\tSentenceVariantDTO cannot be resolved to a type\n");
}
public List<SentenceVariantDTO> toDTOList(List<SentenceVariant> entityList) {
throw new Error("Unresolved compilation problems: \n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTOList(List<SentenceVariant>) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n\tThe method toDTO(SentenceVariant) from the type SentenceVariantMapperImpl refers to the missing type SentenceVariantDTO\n");
}
public List<SentenceVariant> toEntityList(List<SentenceVariantDTO> dtoList) {
throw new Error("Unresolved compilation problems: \n\tThe method toEntityList(List<SentenceVariantDTO>) of type SentenceVariantMapperImpl must override or implement a supertype method\n\tSentenceVariantDTO cannot be resolved to a type\n\tSentenceVariantDTO cannot be resolved to a type\n");
}
}jdk version: Oracle OpenJDK 17.0.1 |
Beta Was this translation helpful? Give feedback.
-
|
I just found this problem. it took me 4-5Hr for find what happend. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a spring boot project that uses the maven to build. I use the mapstruct in one class. But when I execute
mvn spring-boot:run, it failed with the message: "Caused by: java.lang.Error: Unresolved compilation problems:". It is very strange as themvn compilecommand can succeed. Then I check the compiled mapper class, it only contains an exception statement, like below:Looks like mapstruct genereted a java file only contains the error throw statement?
I am using :
Java : Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286) from Oracle
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Spring boot: 3.4.1
MapStruct: tried both 1.6.3 and 1.5.5 final
Beta Was this translation helpful? Give feedback.
All reactions