Add example of configuration arguments using Maven in Kotlin example
Can we get added to the pom.xml file in the kotlin example some configuration arguments?
Right now I have the following and it's not working...because kapt is being used rather than the maven compiler plugin for annotation processing (and after a lot of googling and searching, I can't find anything on how kapt processor args are meant to be formatted when using maven):
...
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<args>
<arg>-Amapstruct.defaultComponentModel=spring</arg>
<arg>-Amapstruct.unmappedTargetPolicy=IGNORE</arg>
<arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
<arg>-Amapstruct.suppressGeneratorVersionInfoComment=true</arg>
</args>
...
Maybe you could ask in the Kotlin forum, user group etc. what's the correct way for passing processor arguments?
I had the same problem here with a kotlin/mapstruct/gradle projekt and ended up here. Finally I found a solution which I wanted to share:
kapt {
correctErrorTypes = true
arguments {
arg("mapstruct.defaultComponentModel", "spring")
arg("mapstruct.unmappedTargetPolicy", "ERROR")
}
}
for kapt in maven here is working solution - working on mapstruct 1.3.0.Final
`
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${kotlin.version}</version>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
<arg>-Xjvm-default=enable</arg>
</args>
</configuration>
<executions>
<execution>
<id>kapt</id>
<goals>
<goal>kapt</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>src/main/kotlin</sourceDir>
<sourceDir>src/main/java</sourceDir>
</sourceDirs>
<annotationProcessorPaths>
<annotationProcessorPath>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</annotationProcessorPath>
</annotationProcessorPaths>
<annotationProcessorArgs>
<annotationProcessorArg>
mapstruct.unmappedTargetPolicy=ERROR
</annotationProcessorArg>
</annotationProcessorArgs>
</configuration>
</execution>
</executions>
`
thanks @hemeroc & @hellxcz