Use a publisher more than once. Select the execution order of the publishers. Use run conditions to decide whether a publisher should be run.
Import existing publishers
Used with multi-configuration projects
If you always add your Post-build Actions to Flexible publish, then not only will you be able to change the execution order afterwards, but you will have the ability to temporarily disable a publisher without losing the publishers' configuration.
This plugin can be installed from the Update Center (Manage Jenkins > Manage Plugins) under "Other Post-Build Actions".
To install manually, download the latest plugin from http://mirrors.jenkins-ci.org/plugins/flexible-publish/ and use the Upload Plugin option in the Advanced tab of the Plugin Manager.
If you do install manually, you will need to also install the Run Condition Plugin from http://mirrors.jenkins-ci.org/plugins/run-condition/ and the Token Macro Plugin from http://mirrors.jenkins-ci.org/plugins/token-macro/.
In Manage Jenkins/ Script console, copy the following to see which publishers can be moved (for a job named 'My Job')
import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.* def job = hudson.model.Hudson.instance.getItem('My Job') list job
Or, if you like doing it the hard way ...
You should see a list something like this
Result: Enabled publishers that can be moved: [Publish Checkstyle analysis results] [Publish FindBugs analysis results] [Publish PMD analysis results] [Publish duplicate code analysis results] [Scan for compiler warnings] [Scan workspace for open tasks] [Publish combined analysis results] [Archive the artifacts] [Publish JUnit test result report] [Publish Javadoc] [Record fingerprints of files to track usage] [Git Publisher] [Send build artifacts over FTP] [Send build artifacts over SSH] [Send build artifacts to a windows share] Enabled publishers that cannot be moved: [Aggregate downstream test results] [Build other projects] [Record Emma coverage report] [Report Violations] [E-mail Notification]
You can move a publisher into Flexible publish
import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.* def job = hudson.model.Hudson.instance.getItem('My Job') movePublisher job, 'Publish JUnit test result report'
After moving one or more publishers, go to the configure page, check everything looks ok, then save the configuration.
If you like to live on the edge, and would like to move all of the publishers in one go, then ...
import static org.jenkins_ci.plugins.flexible_publish.JobUpdater.* def job = hudson.model.Hudson.instance.getItem('My Job') moveAllPublishers job
Almost every publisher I have tried works without issue.
The three exceptions are
When you use Flexible Publish Plugin with multi-configuration projects (aka. matrix projects), you should know followings:
Generally, publishers run in two phase for multi-configuration projects.
For example, "Publish JUnit test result report" works:
You can specify conditions both for each combination and the aggregation.
If you want to separate condition for them, check "Condition for Matrix Aggregation" (This appears only in multi-configuration projects).
This is especially useful for the case you want control the execution of the publisher depends on combination of axes.
Be careful to specify the condition, for inconsistent execution causes the build fails.