我看到过很多帖子以及Lombok Github帐户,其中与找不到映射属性有关的问题处于关闭状态。
但是我的用例出现问题:
POM.XML
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
接口
@Mapping(source = "customfields", target = "customfields", ignore = true)
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
错误:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/EvryIntegrator/Projects/Snow/src/main/java/com/integrator/snow/util/LicenseMapper.java:[13,9] No property named "customfields" exists in source parameter(s). Did you mean "empty"?
根据各种堆栈溢出帖子,pom似乎是正确的。为什么财产存在时我仍然遇到问题? (使用eclipse 2019)
尝试一下
List<License> jsonToDao(List<com.integrator.snow.vo.license.License> source);
@Mapping(source = "customfields", target = "customfields", ignore = true)
License map(com.integrator.snow.vo.license.License source);