Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of configuration arguments using Maven in Kotlin example #36

Open
bsara opened this issue Dec 13, 2017 · 4 comments
Open

Add example of configuration arguments using Maven in Kotlin example #36

bsara opened this issue Dec 13, 2017 · 4 comments

Comments

@bsara
Copy link

bsara commented Dec 13, 2017

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>
...
@gunnarmorling
Copy link
Member

Maybe you could ask in the Kotlin forum, user group etc. what's the correct way for passing processor arguments?

@hemeroc
Copy link

hemeroc commented Jun 23, 2018

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")
    }
}

@hellxcz
Copy link

hellxcz commented Jun 17, 2019

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>

`

@bsara
Copy link
Author

bsara commented Jun 19, 2019

thanks @hemeroc & @hellxcz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants