Quickly publishing artifacts only after integration tests complete using Jenkins build pipeline

I have a CI build in that is run in stages using the Jenkins Build Pipeline plugin.

Stages: 1. Compile/Unit testing --> 2. Integration testing --> 3. Publish

The pipeline works by executing each stage with a seperate set of commands

Stage 1 : gradle build Stage 2 : gradle intergationTests Stage 3 : gradle uploadArtifacts

The pipeline handles if and when each tasks run depending on whether the previous stage succeeds.

My issue is that because it is executed as different commands gradle must check that everything is up to date before publishing the artifacts.

My question is as this is already guaranteed is it possible to by pass this behaviour and publish without the check?

Thanks for the help.

You can use excludes.


Is it possible to do the reverse and only include a certain task instead of explicitly excluding all others? This would be a bit cleaner for me. Thanks for the help.