Tag Archives: maven

How to deploy tests with Maven on a Virtual Machine via Git

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

mvn test

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.

How to fix Java Error “The trustAnchors parameter must be non-empty” while building Maven Single Jar

Recently I tried to deploy my Java  project as a single fat jar. To my bad awekening, Maven did not feel like creating jars anymore and complained with errors like :

You might encounter an error like this, if you recently reinstalled your java and want to build Jar with maven











The console with spit something like this out :




How to fix the error

To fix the error, we will download the java JDK and extract the certificates into our local java installation.

Get java


Extract the jdk



Copy the Certificate into your java directory


And now you can finally build your jar with