Intellij Maven 默认注释处理器配置丢失
Intellij Maven default annotation processors configuration getting lost
我通过添加对应于 maven-compiler-plugin
的两个 compilerArg
的两个选项,将我的 Maven
项目配置为使用 IntelliJ Idea 2017.1 中的 Annotation processor options
。
我的问题:每次修改 pom.xml
时,IntelliJ 都会重置注释处理配置。有什么办法可以保留配置吗?
已修复新版本的 Maven 编译器插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.defaultComponentModel=${mapstruct.defaultComponentModel}</arg>
</compilerArgs>
</configuration>
</plugin>
之前的配置是
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=${mapstruct.defaultComponentModel}
</compilerArg>
</compilerArgs>
</configuration>
</plugin>
我通过添加对应于 maven-compiler-plugin
的两个 compilerArg
的两个选项,将我的 Maven
项目配置为使用 IntelliJ Idea 2017.1 中的 Annotation processor options
。
我的问题:每次修改 pom.xml
时,IntelliJ 都会重置注释处理配置。有什么办法可以保留配置吗?
已修复新版本的 Maven 编译器插件
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amapstruct.defaultComponentModel=${mapstruct.defaultComponentModel}</arg>
</compilerArgs>
</configuration>
</plugin>
之前的配置是
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgs>
<compilerArg>
-Amapstruct.defaultComponentModel=${mapstruct.defaultComponentModel}
</compilerArg>
</compilerArgs>
</configuration>
</plugin>