在Gradle中设置IntelliJ编译器参数 [英] Setting IntelliJ compiler args in Gradle

查看:99
本文介绍了在Gradle中设置IntelliJ编译器参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要添加-parameters java编译器参数才能使测试成功.我可以在gradle中完成此操作,以使./gradlew build正常工作,或者通过在IntelliJ Settings > Build.. > Compiler > Java Compiler > Additional command line parameters:下添加-parameters手动进行操作,以便它们在IDE中工作,但是我不希望签出此存储库的每个人都必须执行手动步骤.

I need to add the -parameters java compiler parameter for my tests to succeed. I can do this in gradle already for ./gradlew build to work, or manually by adding -parameters under IntelliJ Settings > Build.. > Compiler > Java Compiler > Additional command line parameters: so they work in the IDE, but I don't want everyone who checks out this repo to have to do a manual step.

我的.ipr文件确实显示

<component name="JavacSettings"> <option name="ADDITIONAL_OPTIONS_STRING" value="-parameters" /> </component>

<component name="JavacSettings"> <option name="ADDITIONAL_OPTIONS_STRING" value="-parameters" /> </component>

在手动设置之后,但是是否可以在gradle中配置idea插件,以便./gradlew idea完成所有工作?

after setting it manually, but is it possible to configure the idea plugin in gradle so ./gradlew idea just does all the work?

推荐答案

使用JetBrains的新概念验证"插件可以做到这一点: gradle-idea-ext-plugin 具有以下配置:

It's possible to do that with the new "Proof-of-concept" plugin from JetBrains: gradle-idea-ext-plugin with following configuration:

idea.project.settings {
    compiler {
        javac {
            javacAdditionalOptions "-parameters"
        }
    }
}

这篇关于在Gradle中设置IntelliJ编译器参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆