You can execute the groovy script through the Hudson CLI API , which will add the job to the view. Here is the code:
import hudson.model.*
def job = Hudson.instance.getView("View").getItem("Job")
Hudson.instance.getView("View2").add(job)
and command for CLI:
java -jar hudson-cli.jar -s http:
Note that you must have the groovy support plugin installed on your Hudson instance in order to execute the script. You can install it on: http: // your-hudson-server/ pluginManager.
source
share