How to I struggled installing Eclipse, STS and Maven on Mac OS

Margaryta Chepiga
Sep 5, 2018 · 5 min read
Official Logo

Download Eclipse

Let’s install Eclipse:

Once, installed, move the file to your Applications folder, then open the file to complete the installation process.

Then, open preferences:

Once, you are in the preferences, go to Java -> Installed JREs and select the default JRE for your project:

Then click on Apply and Close button.

Go to this link to download STS:

After the download is complete, go to Eclipse, click on Help and from the dropdown menu select Install New Software:

Then, click on Add button:

For name, I used ‘STS Update Site Archive’, for the location, click on the Archive button to choose to the file you have just downloaded:

Click on Add button.

Next, you will get this screen, where you need to add add the things you wish to install. I selected all:

Then click on Next button. Ideally that would be all. However, as ususal, me being me with all my luck, I managed to get a sligth error:

I picked the Keep my installation the same and modify the items being installed to be completed option, and clicked on Next button:

After a couple of confirmations, I got to the above screen, accepted the license agreement and finally clicked on Finish button.

But then, of course, I got a security warning:

I picked Install Anyway, after which I got another pop up window:

It succesfully restarted.

Install Maven

By The Apache Software Foundation!

“Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

Before we start the installation, let’s make sure that we have the following:

  • JDK installed

If you are not sure if you have JDK installed, you can easily chack by running this command in your terminal:

$ javac -version// if you have JDK installed, the result will be something like the // following:$ javac 1.8.0_131
  • Ensure JAVA_HOME environment variable is set and points to your JDK installation
$ echo $JAVA_HOME

If you don’t get a result, your environmental variable is not set; therefore, you need to set it.

How?

$ vi .bash_profile

Once, editor is open, add this line:

export JAVA_HOME=$(/usr/libexec/java_home)

And just in case if you forgot, to save & exit in vi editor, press colom ( : ) followed by wq => :wq Enter Key

Then run the following command:

$ source .bash_profile

To check if it works, run:

$ echo $JAVA_HOME// the result of the command should be something like this:/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home

Install

Follow this link, to go to the official Maven page:

Download, either tar or zip binary. Once downloaded, extract distribution archive:

$ cd Downloads// Downloads, is my directory where the archive is currently located$ tar xzvf apache-maven-3.5.4-bin.tar.gz

Now it would be a good idea to move the unzip (untar in my case) folder out of Downloads:

$ mv apache-maven-3.5.4 . ../

You can move it anywhere you want, I like to keep things in my home directory.

  • Add the bin directory of the created directory apache-maven-3.5.4 to the PATH environment variable

There are three ways on how you can proceed.

First, manually alter the paths file to add additional path.

Second, using command line alter the PATH variable ( won’t last long though ):

To check PATH variable:

$ echo $PATH// the result most probably be something like this:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

To modify the PATH variable, execute the following:

$ export PATH=/opt/apache-maven-3.5.4/bin:$PATH

Third, and my favourite, is to move the folder into one of the paths that are in the PATH variable.

Example:

$ mv apache-maven-3.5.4/ . ../../usr/local/bin

What does it give you?

Its a way of adding Mavel to your PATH without modifying it.

Run

$ mvn

And then it didn’t work…

By Giphy

Okay, so I was trying to go with the official docs for Mavel, but apparently I messed up something, so might as well use Homebrew for the very first time!

To install Mavel with Homebrew run:

$ brew install maven

After I fixed my problems with proxies and permissions, I was able to finally successfully execute the above command.

Let’s check the version that brew installed:

$ mvn -version

Once executed, you should see something like this:

Apache Maven 3.5.4                                               Maven home: /usr/local/Cellar/maven/3.5.4/libexec .               Java version: 1.8.0_131, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jreDefault locale: en_CA, platform encoding: UTF-8                    OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"

Contrast!

Margaryta Chepiga

Written by

Software Developer, known as overexcited girl who is passionate about technology

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade