The following options were not recognized by any processor: '[mapstruct.defaultComponentModel, mapst

2,663 views
Skip to first unread message

Brandon Lamb

unread,
Feb 27, 2016, 10:31:07 AM2/27/16
to mapstruct-users
Hello, I am trying to see if I am doing something obviously dumb. I've tried both 2.2.4 and 3.1.0 of the maven-processor-plugin. I have not tried a different version of mapstruct yet.

[INFO] --- maven-processor-plugin:2.2.4:process (process) @ order ---
[WARNING] diagnostic: warning: The following options were not recognized by any processor: '[mapstruct.defaultComponentModel, mapstruct.suppressGeneratorTimestamp]'

<version.mapstruct>1.0.0.Final</version.mapstruct>

<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${version.mapstruct}</version>
</dependency>

<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<!--<version>3.1.0</version>-->
<version>2.2.4</version>

<configuration>
<defaultOutputDirectory>
${project.build.directory}/generated-sources
</defaultOutputDirectory>

<processors>
<processor>org.mapstruct.ap.MappingProcessor</processor>
</processors>

<options>
<mapstruct.suppressGeneratorTimestamp>true</mapstruct.suppressGeneratorTimestamp>
<mapstruct.defaultComponentModel>cdi</mapstruct.defaultComponentModel>
</options>
</configuration>

<executions>
<execution>
<id>process</id>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>

<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${version.mapstruct}</version>
</dependency>
</dependencies>
</plugin>





Andreas Gudian

unread,
Feb 27, 2016, 11:02:27 AM2/27/16
to mapstruct-users
Doesn't look suspicious... The warning originates from javac, which is called by the processor plugin. Are there maybe no sources to compile?

Anyway, there is something else you could try instead of using the processor-maven-plugin. Use the latest version of the maven-compiler-plugin and add the mapstruct-processor to the annotationProcessorPath there:

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5.1</version>
    <configuration>
        <annotationProcessorPaths>
            <path>

                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-processor</artifactId>
                <version>${version.mapstruct}</version>
            </path>
        </annotationProcessorPaths>
        <compilerArgs>
            <arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
            <arg>-Amapstruct.defaultComponentModel=cdi</arg>
        </compilerArgs>
    </configuration>
</plugin>


Note on IDE support: If you use Eclipse, you might need to update the m2e-apt plugin to 1.2.0 for it to pick up the configuration correctly. On NetBeans, it works out of the box anyway. For IntelliJ, you'd have to configure the Annotation-Processing manually anyway.

Hope it helps,
Andreas

--
You received this message because you are subscribed to the Google Groups "mapstruct-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-use...@googlegroups.com.
To post to this group, send email to mapstru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brandon Lamb

unread,
Feb 27, 2016, 11:09:20 AM2/27/16
to mapstruct-users

On Saturday, February 27, 2016 at 8:02:27 AM UTC-8, Andreas Gudian wrote:
Doesn't look suspicious... The warning originates from javac, which is called by the processor plugin. Are there maybe no sources to compile?

Anyway, there is something else you could try instead of using the processor-maven-plugin. Use the latest version of the maven-compiler-plugin and add the mapstruct-processor to the annotationProcessorPath there:

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.5.1</version>
    <configuration>
        <annotationProcessorPaths>
            <path>
                <groupId>org.mapstruct</groupId>
                <artifactId>mapstruct-processor</artifactId>
                <version>${version.mapstruct}</version>
            </path>
        </annotationProcessorPaths>
        <compilerArgs>
            <arg>-Amapstruct.suppressGeneratorTimestamp=true</arg>
            <arg>-Amapstruct.defaultComponentModel=cdi</arg>
        </compilerArgs>
    </configuration>
</plugin>


Note on IDE support: If you use Eclipse, you might need to update the m2e-apt plugin to 1.2.0 for it to pick up the configuration correctly. On NetBeans, it works out of the box anyway. For IntelliJ, you'd have to configure the Annotation-Processing manually anyway.

Hope it helps,
Andreas


Thanks for the tip, I'll try that. I also came across a mapstruct + lombok thread so looks like I will have other issues to work out now anyway.
:)

Brandon 

Gunnar Morling

unread,
Mar 18, 2016, 3:31:23 AM3/18/16
to mapstruct-users
Hi Brandon,

For the default component model, I recommend to make use of a @MapperConfig class for configuring this (see http://mapstruct.org/documentation/1.1/reference/html/index.html#shared-configurations). In hindsight, the processor options should have only been added for stuff like "suppressGenerationTimestamp" etc.

--Gunnar

Reply all
Reply to author
Forward
0 new messages