Intellij Maven默认注释处理器配置丢失

时间:2017-05-16 11:04:42

标签: maven intellij-idea annotation-processing

我通过添加两个与Maven Annotation processor options compilerArg对应的选项,将我的maven-compiler-plugin项目配置为使用IntelliJ Idea 2017中的pom.xml

我的问题:每次修改+(void) showMessageAlert:(NSString *) title andMessage:(NSString*) msg andDoneMsg:(NSString*) done fromViewController: (UIViewController)viewController{ UIAlertController *showMsgAlertController = [UIAlertController alertControllerWithTitle: title message: msg preferredStyle: UIAlertControllerStyleAlert]; UIAlertAction *showMsgAlertControllerOkAction = [UIAlertAction actionWithTitle:done style:UIAlertActionStyleDefault handler:nil]; [showMsgAlertController addAction:showMsgAlertControllerOkAction]; dispatch_async(dispatch_get_main_queue(), ^{ [viewController presentViewController:showMsgAlertController animated:YES completion:nil]; }); } @end 时,IntelliJ都会重置注释处理配置。有没有办法保持配置?

1 个答案:

答案 0 :(得分:1)

修复了新版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>