How to deploy tests with Maven on a Virtual machine.
In this tutorial you will learn how to deploy your Java project onto any VM and how to deploy and run it via MVN.
We will go over the following points.
1. Add project to github
We first need to have a github project
2.Add SSH keys on VM (optional)
Add a SSH key on your VM and then add it to your github account. Follow this tutorial if you are not sure how to do this : https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
3. Clone Project to VM
Get the URL of your repo and clone it to your VM
4. Compile project
|mvn clean test-compile|
5. Run Tests
This will execute all you compiled tests within the /target/test-classes folder.
6. Run a specific test function
|mvn -Dtest=testClass#testMethod test|
This command will run the method “testMethod” inside of the “testClass”
Recap – What have we learned?
Congratulations, you have learned how to elegantly deploy your Java project on a remote virtual machine using Git and Maven.