MacBook Pro builds maven environment to download jar package

Today, I want to use itext's jar package. I went to the official website and found that I can only download it with maven, but I changed my phone number before. I can't help it. Please try to set up Maven again. Record here and share it or find it in the future

The first choice is to make sure that the jdk is installed on your environment. If not, install it first

Go to the official website to download the installation package, and then unzip it into any directory, preferably in pure English

Open command line

vi .bash_profile



export PATH

Press esc


Then restart the computer, open the command line again, and enter mvn -v

If you can return

localhost:~ userName$ mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T15:58:13+08:00)
Maven home: /Users/userName/apache-maven-3.5.2
Java version: 1.7.0_80, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.4", arch: "x86_64", family: "mac"

It shows that maven environment has been built successfully.

At this time, on your computer, open another directory and create two files

This is pom.xml

<?xml version="1.0"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
<!-- What to download jar You don't need to worry about the rest of the package-->




The next step is file

mvn -f /Users/userName/maven2Jars/pom.xml dependency:copy-dependencies


Well, that's it. It's done. Then go to the command line and execute it with the SH command The file will do.

You can also Change to download.command File so that it can be executed in Mac OS by double clicking.



Just as a record to share, I hope it can help people.

Keywords: OS X Maven Apache Java Mac

Added by wizzkid on Sun, 31 May 2020 18:19:59 +0300