Monthly Archives: November 2017

SQLServer JDBC Driver and Maven

com.microsoft.sqlserver
sqljdbc41
4.1
runtime

The issue is that Maven can’t find this artifact in any of the configured maven repositories.

Unfortunately Microsoft don’t make this available via any maven repository. You need to download the jar from the Microsoft website, and then manually install it into your local maven repository.

You can do this with the following maven command:

mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar

Then next time you run maven on your POM it will find the artifact.

How To Install Apache Maven on CentOS/RHEL 7/6/5

Step 1 – Install Apache Maven

After verifying java version on you system. Download Apache maven from its official website or use following command to download Apache Maven 3.3.9.

$ cd /opt
$ wget http://www-eu.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz

Now extract downloaded archive using following command.

$ sudo tar xzf apache-maven-3.3.9-bin.tar.gz
$ sudo ln -s apache-maven-3.3.9 maven

Step 2 – Setup Environment Variables

As you have downloaded pre compiled Apache Maven files on your system. Now set the environments variables by creating new file /etc/profile.d/maven.sh.

$ sudo vi /etc/profile.d/maven.sh

and add following content.

export M2_HOME=/opt/maven
export PATH=${M2_HOME}/bin:${PATH}

Now load the environment variables in current shell using following command.

$ source /etc/profile.d/maven.sh

Step 4 – Check Version

Apache Maven has been successfully configured on your system. Use following command to check version of Maven.

$ mvn -version