1. 在@Mapper注解中Ignore掉
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface CustomerPaintMapper {
2. 如果太多可以在build.gradle
中ignore掉unmapped提示
apply plugin: 'java'
compileJava{
options.compilerArgs <<"-Amapstruct.unmappedTargetPolicy=IGNORE"
}
3.maven pom.xml中
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Amapstruct.unmappedTargetPolicy=IGNORE
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>