You have a plugin that you want to add to two phases: test, and deploy. The test-phase binding should always run, but the deploy-phase binding should be optional.
Simply put the deploy-phase binding into a profile.
Under normal circumstances, you don't want the optional deployment bindings to execute, so you simply use:
mvn -P deploy-optional deploy