 It will download apache-maven-xxx-bin.zip file into your Downloads directory. You will install it in your user home directory, so open a new Terminal window, and type the following command:      mv Downloads/apache-maven-xxx-bin.zip $HOMEThis command moves the zip file into your user home directory. And type the following command to unzip it:
It will download apache-maven-xxx-bin.zip file into your Downloads directory. You will install it in your user home directory, so open a new Terminal window, and type the following command:      mv Downloads/apache-maven-xxx-bin.zip $HOMEThis command moves the zip file into your user home directory. And type the following command to unzip it:unzip apache-maven-xxx-bin.zip
cat > .zshrc
export MAVEN_HOME=$HOME/apache-maven-xxx
export PATH=$MAVEN_HOME/bin:$PATH
Hit Enter and press Ctrl + D to save the file. The following screenshot illustrates the above steps: Then quit the terminal and open a new one for the change to system environment variables take effect. In the new terminal, type mvn -v to check version of Maven:
Then quit the terminal and open a new one for the change to system environment variables take effect. In the new terminal, type mvn -v to check version of Maven: If you see this screen, that means you have successfully installed Maven on macOS. You see, the command prints version information of Maven, Java and operating system.
If you see this screen, that means you have successfully installed Maven on macOS. You see, the command prints version information of Maven, Java and operating system. Enter groupId, artifactId, version and package as shown above, then type Y to confirm. Then you should see the BUILD SUCCESS message like this:
Enter groupId, artifactId, version and package as shown above, then type Y to confirm. Then you should see the BUILD SUCCESS message like this: Explore the generated project under MyJavaApp directory. You should see the Maven project file (pom.xml), the main class (App.java) and the test class (AppTest.java).Next, let’s compile and build the project into a Java Archive (JAR) file. Type the following commands:
Explore the generated project under MyJavaApp directory. You should see the Maven project file (pom.xml), the main class (App.java) and the test class (AppTest.java).Next, let’s compile and build the project into a Java Archive (JAR) file. Type the following commands:cd MyJavaApp
mvn package
You’ll see the following output: The result is a JAR file name MyJavaApp-1.0.jar created under target directory. To run this Java program, type the following command:                java -cp target\MyJavaApp-1.0.jar net.codejava.AppYou can see it print “Hello World!” message.That’s my tutorial about download, install Apache Maven on macOS. You also learned how to create a simple Java project using Maven command line tool, and how to build and run it.To see the steps in action, watch the following video:
The result is a JAR file name MyJavaApp-1.0.jar created under target directory. To run this Java program, type the following command:                java -cp target\MyJavaApp-1.0.jar net.codejava.AppYou can see it print “Hello World!” message.That’s my tutorial about download, install Apache Maven on macOS. You also learned how to create a simple Java project using Maven command line tool, and how to build and run it.To see the steps in action, watch the following video:  Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.
Nam Ha Minh is certified Java programmer (SCJP and SCWCD). He began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.