Java Mapstruct UnappedTargetPolicy警告似乎没有效果
我正在使用Mapstruct 1.3.0投影此源对象Java Mapstruct UnappedTargetPolicy警告似乎没有效果,java,maven,pom.xml,mapstruct,Java,Maven,Pom.xml,Mapstruct,我正在使用Mapstruct 1.3.0投影此源对象 import lombok.Data; @Data public class SimpleSource { private String firstField; private String secondField; private String noMappingDefined; } 在本DTO中: import lombok.Data; @Data public class SimpleDestination {
import lombok.Data;
@Data
public class SimpleSource {
private String firstField;
private String secondField;
private String noMappingDefined;
}
在本DTO中:
import lombok.Data;
@Data
public class SimpleDestination {
private String field1;
private String field2;
}
在我的界面中,我没有为字段“noMappingDefined”定义任何映射
在生成项目时,将POM中的compilerArgs中的unmappedTargetPolicy设置为WARN不会导致任何通知,并且在Mapstruct生成的目标类中找不到没有映射的字段
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.3.0.Beta2</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
<compilerArg>
-Amapstruct.unmappedTargetPolicy=WARN
</compilerArg>
</compilerArgs>
</configuration>
1.8
1.8
org.mapstruct
mapstruct处理器
1.3.0.2
org.projectlombok
龙目
${lombok.version}
-Amapstruct.defaultComponentModel=弹簧
-Amapstruct.unappedTargetPolicy=WARN
生成的类没有像预期的那样包含unmapped字段,但我希望在构建项目时看到警告
如果我将UnappedTargetPolicy更改为ERROR,则生成失败
无论我是在POM中还是在接口上的@Mapper注释中配置,行为都是相同的
还有其他人遇到过这个问题吗?我正在做一个有数百个字段需要映射的项目,并不是所有字段都是关键的,但如果我遗漏了任何字段,那就太好了
谢谢。这是POM问题,我添加了showWarnings标签并将其设置为true
<showWarnings>
true
</showWarnings>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
<compilerArg>
-Amapstruct.unmappedTargetPolicy=WARN
</compilerArg>
</compilerArgs>
真的
-Amapstruct.defaultComponentModel=弹簧
-Amapstruct.unappedTargetPolicy=WARN
现在我看到了我在构建项目时预期的警告
<showWarnings>
true
</showWarnings>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=spring
</compilerArg>
<compilerArg>
-Amapstruct.unmappedTargetPolicy=WARN
</compilerArg>
</compilerArgs>