Working with self-hosted Maven central repository

Ignore server SSL certificate validity check:

mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true


If you wish to add this setting globally, add an alias to mvn command:

In Linux (Ubuntu), edit ~/.bashrc and add the following line in the bottom of the file.

alias mvn="mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true"

Now, put this change into effect immediately.

source ~/.bashrc

Now, whenever you execute a mvn command, it always substitutes the command with mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true, which will always ignore the SSL certificate check.

What do these params mean?

  • -Dmaven.wagon.http.ssl.insecure=true – enable use of relaxed SSL check for user generated certificates.
  • -Dmaven.wagon.http.ssl.allowall=true – enable match of the server’s X.509 certificate with hostname. If disabled, a browser like check will be used.
  • -Dmaven.wagon.http.ssl.ignore.validity.dates=true – ignore issues with certificate dates.


Official documentation can be found here.

NOTE: The above method was purely intended for developers who constantly keep changing their machines and don’t wish to setup the SSL certificate in every machine. This is for those of you who are lazy! 🙂

Right way of setting up SSL certificates:

Get the valid SSL certificate file from certificate distributor/admin and place it in your machine.

Import the certificate into your Java environment:

keytool -import -keystore /path/to/java_home/lib/security/cacerts -alias mavenrepo -file /path/to/cer/file

You’re now good to go.

NOTE: Now this is a sane method of setting up SSL certificate check for your self-hosted Maven repository

Using Git

So, the things around the world are changing rapidly. We’re in the era where almost every person has a smartphone. People talk to others more online and less offline (it’s their fingers which talk, and not their tongue). This has hugely impacted the software industry. Software development and computing is shooting to the sky. More mobile phone variants, more computing platforms, more apps, and yet it still feels incomplete! Lots of competition, money spilling/grabbing and everyone wants a piece of it. It seems like the people are running faster and faster, day by day, and as they do so, the world to seems to be rotating faster to keep up the pace.

Almost every software organisation is now following Agile Software Development. When there’s agility, there’s cursing, blaming and hatred. People work in groups for building a software piece, a bunch of the guys collaborate to work on the same codebase. As they do so, one may mess up the work that the other guy in the group had done, it repeats several times and then emerges cold war (or even worse) amongst the group. This is where we make a switch to better code versioning/revisioning.

Git is a code revisioning tool/system which lets every person in a team to have their own copy of the code locally. So when changes are made to he code by one person, it doesn’t affect the others. The person can continue working on his local copy smoothly and when everyone’s code has to be put together, they all sit together, discuss and merge their code peacefully.

git init
echo "test" > hello.js
git add .
git commit -m "initial commit"
git push

Navigate to your project directory and initialize it for git:

cd /path/to/project/directory
git init

Now your project directory has been initialized, which means, you can now perform git operations on this directory.

If the project directory is empty and you haven’t added any code, you could add them first. If you already have added your project files, you can now add each of them for versioning:

 git add . 

By doing this, you’re telling git to add all the files of the directory for versioning. Git can then maintain revisions of each file.