I updated mapstruct from 1.3.1 to 1.4.1 and now I'm having problems mapping one class:
Having:
@Override
@Mapping(target = "dependantBuildRecords", ignore = true)
/*
* Builder that MapStruct uses when generating mapper has method dependantBuildRecord() which confuses MapStruct as
* he thinks it is a new property
*/
@Mapping(target = "dependantBuildRecord", ignore = true)
Artifact toEntity(org.jboss.pnc.dto.Artifact dtoEntity);
I'm getting following error:
ArtifactMapper.java:[68,14] Unknown property "dependantBuildRecord" in result type Artifact. Did you mean "dependantBuildRecords"?
And after removing the @Mapping
@Override
@Mapping(target = "dependantBuildRecords", ignore = true)
/*
* Builder that MapStruct uses when generating mapper has method dependantBuildRecord() which confuses MapStruct as
* he thinks it is a new property
*/
// @Mapping(target = "dependantBuildRecord", ignore = true)
Artifact toEntity(org.jboss.pnc.dto.Artifact dtoEntity);
I'm getting this error instead:
ArtifactMapper.java:[68,14] Unmapped target property: "dependantBuildRecord".
It seems that mapstruct is now confused more then before.
This is the Artifact class (stripped of unrelated stuff):
public class Artifact implements GenericEntity<Integer> {
@ManyToMany(mappedBy = "dependencies")
private Set<BuildRecord> dependantBuildRecords;
public Set<BuildRecord> getDependantBuildRecords() {
return dependantBuildRecords;
}
public void setDependantBuildRecords(Set<BuildRecord> buildRecords) {
this.dependantBuildRecords = buildRecords;
}
public void addDependantBuildRecord(BuildRecord buildRecord) {
dependantBuildRecords.add(buildRecord);
buildRecord.getDependencies().add(this);
}
public void removeDependantBuildRecord(BuildRecord buildRecord) {
dependantBuildRecords.remove(buildRecord);
buildRecord.getDependencies().remove(this);
}
public static class Builder {
private Set<BuildRecord> dependantBuildRecords = new HashSet<>();
public Builder dependantBuildRecord(BuildRecord dependantBuildRecord) {
this.dependantBuildRecords.add(dependantBuildRecord);
return this;
}
public Builder dependantBuildRecords(Set<BuildRecord> dependantBuildRecords) {
this.dependantBuildRecords = dependantBuildRecords;
return this;
}
}
}
I updated mapstruct from 1.3.1 to 1.4.1 and now I'm having problems mapping one class:
Having:
I'm getting following error:
And after removing the
@MappingI'm getting this error instead:
It seems that mapstruct is now confused more then before.
This is the Artifact class (stripped of unrelated stuff):