Is it possible to run a Bash script from Maven?

后端 未结 7 1768
無奈伤痛
無奈伤痛 2021-02-05 01:53

For creating configuration of my application I need to run bash script. Is it possible to integrate execution of Bash scripts in Maven, maybe there are some plugins?

7条回答
  •  庸人自扰
    2021-02-05 02:43

    To experiment with commands you can use exec:exec:

    $ mvn exec:exec -q -Dexec.executable=echo -Dexec.args="your   arguments"
    your arguments
    
    $ mvn exec:exec -q -Dexec.executable=echo -Dexec.args="'your   arguments'"
    your   arguments
    

    This demonstrates:

    • passing arguments: if you need to pass several arguments: just split them with space
    • if you need to pass an argument with spaces: enclose it in quotes, as you would do in bash script/terminal
    • -q to shut up the mvn log

提交回复
热议问题