Gradle task - pass arguments to Java application

后端 未结 7 2196
春和景丽
春和景丽 2020-12-04 14:40

I have a Java application that runs with a custom gradle task and the application requires some arguments upon being invoked. These are:

programName ( string         


        
7条回答
  •  清歌不尽
    2020-12-04 15:24

    You need to pass them as args to the task using project properties, something like:

    args = [project.property('h')]
    

    added to your task definition (see the dsl docs)

    Then you can run it as:

    gradle -Ph run
    

提交回复
热议问题