Mapstruct:未知 属性 "updateDate" 结果类型 com.integrator.license.License。您是说 "updatedDate" 吗?
Mapstruct: Unknown property "updateDate" in result type com.integrator.license.License. Did you mean "updatedDate"?
我在 Mapstruct 中遇到以下错误。根据各种帖子,此错误不应出现在最新版本中。
以下为全部配置:
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project Snow: Compilation failure
[ERROR] /C:/Projects/Now/src/main/java/com/integrator/util/LicenseMapper.java:[20,25] Unknown property "updateDate" in result type com.integrator.license.License. Did you mean "updatedDate"?
[ERROR] -> [Help 1]
代码:
@Mappings({
@Mapping(source = "updatedDate", target = "updateDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss"),
@Mapping(source = "purchaseDate", target = "purchaseDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss")
})
License entityToDao(com.integrator.vo.license.License source);
POM:
<properties>
<org.mapstruct.version>1.3.1.Final</org.mapstruct.version>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>
.
.
<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>
这个问题在代码中吗?
你的目标是target = "updateDate"
应该是target = "updatedDate"
您错过了 "updated"
中的 d
我在 Mapstruct 中遇到以下错误。根据各种帖子,此错误不应出现在最新版本中。
以下为全部配置:
错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project Snow: Compilation failure
[ERROR] /C:/Projects/Now/src/main/java/com/integrator/util/LicenseMapper.java:[20,25] Unknown property "updateDate" in result type com.integrator.license.License. Did you mean "updatedDate"?
[ERROR] -> [Help 1]
代码:
@Mappings({
@Mapping(source = "updatedDate", target = "updateDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss"),
@Mapping(source = "purchaseDate", target = "purchaseDate", dateFormat = "yyyy-MM-dd'T'HH:mm:ss")
})
License entityToDao(com.integrator.vo.license.License source);
POM:
<properties>
<org.mapstruct.version>1.3.1.Final</org.mapstruct.version>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>
.
.
<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>
这个问题在代码中吗?
你的目标是target = "updateDate"
应该是target = "updatedDate"
您错过了 "updated"
中的 d