How to optimize gradle build performance regarding build duration and RAM usage?

后端 未结 9 1409

I am currently switching from ant to gradle for my multi module web application and at the moment it seems that the current version of Gradle (M9) might be running up agains

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 12:01

    None of the above answers worked for me, then I found this-

    My System Configuration-

    Windows x64 - JDK 32 bit - Cordova 5.4.1 - Ionic 1.7.12
    

    JVM options for running Gradle can be set via environment variables. You can use either GRADLE_OPTS or JAVA_OPTS, or both. JAVA_OPTS is by convention an environment variable shared by many Java applications. A typical use case would be to set the HTTP proxy in JAVA_OPTS and the memory options in GRADLE_OPTS. Those variables can also be set at the beginning of the gradle or gradlew script.

    I added the below mentioned two Environment Variables and solved this issue-

    Variable Name: GRADLE_OPTS
    Variable Value: -Xmx512m
    
    Variable Name: JAVA_OPTS
    Variable Value: -Xmx512m
    

    Hope this helps to guys like me.

提交回复
热议问题