Easy setup, yet I cannot find how to achieve it: I have an application with a main class, which can take several command line arguments, and depending on them does different things.
Now I simply want to create tasks which call the program with some specific arguments. E.g. a task doSomething, which calls the main class with “–something”, so that ‘’‘gradle doSomething’’’ executes my main class with some arguments.
I am using the application plugin, but can’t find how to call it with different parameters depending on the task.
Don’t know, if that’s idiomatic, though. Coming to think of it, I guess you don’t need the subclass, unless you want to share some common configuration.
Right, no need to subclass. And if you wanted to provide a custom API, you’d usually declare a task class that delegates to ‘project.javaexec’, rather than inheriting from ‘JavaExec’.