Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting IntelliJ compiler args in Gradle

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.

My .ipr file does show

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

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

like image 846
mathematician Avatar asked Mar 21 '17 01:03

mathematician


1 Answers

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"
        }
    }
}
like image 153
moneytoo Avatar answered Sep 27 '22 18:09

moneytoo