{"id":2372,"date":"2022-10-19T17:23:24","date_gmt":"2022-10-19T17:23:24","guid":{"rendered":"https:\/\/blog.samarthya.me\/wps\/?p=2372"},"modified":"2022-10-19T17:23:26","modified_gmt":"2022-10-19T17:23:26","slug":"tip-maven","status":"publish","type":"post","link":"https:\/\/blog.samarthya.me\/wps\/2022\/10\/19\/tip-maven\/","title":{"rendered":"Tip #Maven"},"content":{"rendered":"\n<p>A decent developer trick is to ensure your <code>maven<\/code> points to the right <code>JAVA<\/code> version, and if you have freshly installed maven it will be pointing to the default available. <\/p>\n\n\n\n<p>On my system&#8217;s dev or otherwise I normally take the help of the <code>profile.d<\/code> directory to allow me set the custom version. <\/p>\n\n\n\n<p>This directory defines a system-wide behavior.<\/p>\n\n\n\n<p>I created a <code>maven.sh<\/code> in this folder &amp; put the contents as below<\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-pale-cyan-blue-background-color has-text-color has-background has-small-font-size\"><code>export JAVA_HOME=\/usr\/lib\/jvm\/java-11-openjdk-11.0.16.1.1-1.el7_9.x86_64\nexport M2_HOME=\/usr\/share\/maven\nexport MAVEN_HOME=\/usr\/share\/maven\nexport PATH=${M2_HOME}\/bin:${PATH}<\/code><\/pre>\n\n\n\n<p>Then source it <code>source \/etc\/profile.d\/maven.sh<\/code><\/p>\n\n\n\n<p>Once you do that you can validate the <code>mvn --version<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-luminous-vivid-amber-background-color has-text-color has-background has-medium-font-size\"><code>Apache Maven 3.0.5 (Red Hat 3.0.5-17)\nMaven home: \/usr\/share\/maven\nJava version: 11.0.16.1, vendor: Red Hat, Inc.\nJava home: \/usr\/lib\/jvm\/java-11-openjdk-11.0.16.1.1-1.el7_9.x86_64\nDefault locale: en_US, platform encoding: UTF-8\nOS name: \"linux\", version: \"3.10.0-1160.76.1.el7.x86_64\", arch: \"amd64\", family: \"unix\"<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A decent developer trick is to ensure your maven points to the right JAVA version, and if you have freshly installed maven it will be pointing to the default available. On my system&#8217;s dev or otherwise I normally take the help of the profile.d directory to allow me set the custom version. This directory defines [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2374,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"image","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[34,239],"tags":[133,267],"class_list":["post-2372","post","type-post","status-publish","format-image","has-post-thumbnail","hentry","category-technical","category-technical-2","tag-maven","tag-tip","post_format-post-format-image"],"_links":{"self":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2372","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/comments?post=2372"}],"version-history":[{"count":1,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2372\/revisions"}],"predecessor-version":[{"id":2375,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/posts\/2372\/revisions\/2375"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media\/2374"}],"wp:attachment":[{"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/media?parent=2372"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/categories?post=2372"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.samarthya.me\/wps\/wp-json\/wp\/v2\/tags?post=2372"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}