How do I add default JVM arguments with Gradle

后端 未结 3 1793
孤独总比滥情好
孤独总比滥情好 2020-12-31 03:55

I need to add default JVM options to my jar, when build with Gradle. From the documentation I got that I have to set:

applicationDefaultJvmArgs = [\"-Djavafx         


        
3条回答
  •  南笙
    南笙 (楼主)
    2020-12-31 04:16

    you can use command-line with gradle task:

    class AppRun extends JavaExec {
        private boolean withDebug
    
        @Option(option = "with-debug", description = "enable debug for the process. ")
        public void setDebugMode(boolean debug) {
            this.withDebug = debug
        }
    
        public boolean getDebugMode() {
            return this.withDebug
        }
    }
    
    task run(type: AppRun) {
    }
    

    then run task with options

    gradle run --with-debug

提交回复
热议问题