Depending on your level of testing the recommended maven approach would be one of the following

For unit tests
Put any startup of maven and possibly deployment in the pretest phase


process-test-classes


Then run the tests in the test phase


test


This approach will work if the unit tests themselves need to be deployed to tomcat to run small parts of the code base note there is no way here to shutdown tomcat you will need to find a phase to bind the shutdown to.

For integration tests that need to run the whole war file Put any startup of maven and possibly deployment in the pre-test phases


pre-integration-test


Run the test in the test phase


integration-test


Undeploy and shutdown during the post test phase


post-integration-test


Under this scenario the link you included in your question becomes relevant.

Implement tomcat in java to deploy war
I have three floor joists that have approximately 1/2 inch hole in them less than 2 inches from the bottom. Is there a recommended fix or approved method to correct this to meet code?  These joists are in excellent condition otherwise. Someone drilled through them years ago to run cable through. There are other holes above 2 inches on other joists.
