Let us see how to setup maven project : "A Project Object Model (POM) based management, build, reporting and documentation tool" on Mac Operating system.
Environment:- Operating System: Mac OS X Yosemite 10.10
- Maven version: v3.3.3
- Java version: Java Development Kit JDK 7 or higher
- Disk requirement: min 10Mb
You can download the latest build from the Apache Maven website: https://maven.apache.org/download.cgi.
Note: If you are using an older version of Mac OS X (1.6) you may find maven installed under /usr/share/maven.
Setting up maven:- Download maven Binary tar.gz archive ( latest: http://mirror.nexcess.net/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz)
- Go to terminal app
- Execute the following commands to set Java and Maven bin path :
export PATH=/Users/username/Setups/apache-maven-3.3.3/bin:$PATH JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/
To check if maven is configured correctly run the following command: mvn -version
localhost:Users username$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T17:27:37+05:30)
Maven home: /Users/username/Setups/apache-maven-3.3.3
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac"
localhost:Users username$
Note: If the path is not set correctly you may get errors when you run mvn - version
localhost:Users username$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/
localhost:Users username$ mvn -version
Error: JAVA_HOME is not defined correctly.
We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Hom//bin/java
localhost:Users username$
Note: Maven 3.3.3 requires java version 1.7 or above, if you use a version below it you may get the following error,
localhost:Users username$ mvn --version
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:2337)
at java.lang.ClassLoader.defineClass(ClassLoader.java:121)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:441)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:134)
at java.net.URLClassLoader.access$000(URLClassLoader.java:13)
at java.net.URLClassLoader$1.run(URLClassLoader.java:122)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:240)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:341)
....
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:332)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:135)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:345)
- Transfer files between Android and Mac OS X using usb cable
- Find Java JRE Installation location Mac OS X
- How to enable Do Not Disturb mode for Notification Center in Mac OS X 10.10 Yosemite
- Remove Applications from Startup Mac OS X
- Open New tab using keyboard shortcut in Mac Terminal
- Create a large dummy file using Mac OS X terminal command
- Hide files and folders on Mac OS X
- Install Apache Tomcat ver 8 on Mac OS X Yosemite 10.10
- Location of eclipse.ini file on Mac OS X
- Take Screenshots on Mac OS without Keyboard
- [Solved] Dynamic Web Module 3.0 requires Java 1.6 or newer Mac OSX
- Mac OS X Taking Screen Capture using Terminal
- How to Stop Photos App from auto loading when device connected to the Mac
- Change Mouse Scrolling in Mac OS X
- How to Setup maven on Mac (macOS)
- Mac Studio Display Buzzing sound from the Monitor
- 4 Open Source SQLite Editor for Mac OS X , Windows and Linux
- Save webpage as pdf in Google Chrome for Mac OS X
- vi undo redo command [Examples]
- How to See Hidden Folders and Files on macOS
- [Mac] To open Eclipse you need to install the legacy java se 6 runtime
- Java location in Mac OS X
- Safari appends .html extension to files that are downloaded
- Pdf Text to Speech option in Mac OS X Preview App
- How to run Gradle from Mac Terminal (Command Line)
- Make Android TextView Clickable like Buttons - Android
- Fix: ModuleNotFoundError No module named openpyxl - Python
- java.util.Optional Class Deep Dive Tutorial - Java
- How To Change Mac Terminal Text Color - MacOS
- [Python] Fix: ValueError: All arrays must be of the same length - Python
- Fix Xcode: Git Repository Creation Failed - Git
- Spell check not working in Gmail : Mac OS X - Mac-OS-X
- Share or Send SMS via Android Intent - Android