解决办法
当前mavan模块必须直接导致mapstruct的jar包,不能通过依赖传递来引用
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
<scope>provided</scope>
</dependency>
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Cannot find implementation for Mapstruc.NodeMapper
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:61)
at Mapstruc.NodeMapper.<clinit>(NodeMapper.java:15)
... 22 more
Caused by: java.lang.ClassNotFoundException: Cannot find implementation for Mapstruc.NodeMapper
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:75)
at org.mapstruct.factory.Mappers.getMapper(Mappers.java:58)
... 23 more
一般项目都是最外层的parent pom导入mapstruct mavn版本依赖,然后comm模块引入mapstruct 的jar包,service再依赖common中的mapstruct。这样会就会导致这个问题。