{"id":455,"date":"2018-03-11T03:08:09","date_gmt":"2018-03-11T03:08:09","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=455"},"modified":"2018-05-30T10:42:38","modified_gmt":"2018-05-30T10:42:38","slug":"install-apache-maven-on-centos","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=455","title":{"rendered":"Install Apache Maven on CentOS"},"content":{"rendered":"<p>Apache Maven is a software project management and comprehension tool. IT is commonly used to manage a project&#8217;s build, reporting and documentation from a central repository such as Git, CVS, etc.<\/p>\n<p>Installation of Maven is pretty simple. The procedure is as follows:<\/p>\n<ul>\n<li>Install latest version of Java SDK (<em><strong>yum install java-1.8.0-openjdk-devel -y<\/strong><\/em>). The command &#8220;<strong><em>java -version<\/em><\/strong>&#8221; will display the current version of Java installed.<\/li>\n<li>Navigate to the &#8220;<strong>\/opt<\/strong>&#8221; folder.<\/li>\n<li>Download the compressed copy of Maven. It can be downloaded by using the command : &#8220;<em><strong>wget http:\/\/www-eu.apache.org\/dist\/maven\/maven-3\/3.5.3\/binaries\/apache-maven-3.5.3-bin.tar.g<\/strong><\/em><strong>z<\/strong>&#8220;. If this copy is not available, get the latest available.<\/li>\n<li>This will download the file &#8220;<em><strong>apache-maven-3.5.3-bin.tar.g<\/strong><\/em><strong>z<\/strong>&#8221; in the <em>\/opt<\/em> folder.<\/li>\n<li>Decompress the downloaded file using the command &#8220;<em><strong>tar -xvf apache-maven-3.5.3-bin.tar.gz<\/strong><\/em>&#8220;, which will create a folder named &#8220;<strong>apache-maven-3.3.9<\/strong>&#8221; and contents in it.<\/li>\n<li>Rename the folder &#8220;<em><strong>apache-maven-3.5.3<\/strong><\/em>&#8221; to &#8220;<em><strong>maven<\/strong><\/em>&#8221; using the command &#8220;<em><strong>mv apache-maven-3.5.3\/ \/opt\/maven<\/strong><\/em>&#8220;.<\/li>\n<li>Run the command &#8220;<em><strong>ln -s \/opt\/maven\/bin\/mvn \/usr\/bin\/mvn<\/strong><\/em>&#8221; which will enable users to access the mvn binary without typing the complete path.<\/li>\n<li>Create the following file using a text editor\u00a0using the command &#8220;<strong>vi\u00a0<em>\/etc\/profile.d\/maven.sh<\/em><\/strong>&#8220;, that will setup the required environment variables when a user logs-in to the host. The content of this file should be as follows:<br \/>\n<em>#!\/bin\/bash<\/em><br \/>\n<em>MAVEN_HOME=\/opt\/maven<\/em><br \/>\n<em>PATH=$MAVEN_HOME\/bin:$PATH<\/em><br \/>\n<em>export PATH MAVEN_HOME<\/em><br \/>\n<em>export CLASSPATH=.<\/em><\/li>\n<li>Make the file executable by running the command &#8220;<em><strong>chmod +x \/etc\/profile.d\/maven.sh<\/strong><\/em>&#8220;.<\/li>\n<li>Set the environment variables permanently by running the command &#8220;<em><strong>source \/etc\/profile.d\/maven.sh<\/strong><\/em>&#8220;<\/li>\n<\/ul>\n<p>To test the installation by checking the version of Maven installed by running the command &#8220;<em><strong>mvn &#8211;version<\/strong><\/em>&#8221; from any folder in the host.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Apache Maven is a software project management and comprehension tool. IT is commonly used to manage a project&#8217;s build, reporting and documentation from a central <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=455\" title=\"Install Apache Maven on CentOS\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":642,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,3],"tags":[],"class_list":["post-455","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-linux"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=455"}],"version-history":[{"count":6,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/455\/revisions"}],"predecessor-version":[{"id":607,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/455\/revisions\/607"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/642"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}