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
MAVEN_HOME=/Users/userName/apache-maven-3.5.2 PATH=$MAVEN_HOME/bin:$PATH export MAVEN_HOME export PATH
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="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>temp.download</groupId> <artifactId>temp-download</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <!-- What to download jar You don't need to worry about the rest of the package--> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.5.12</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itext-pdfa</artifactId> <version>5.5.12</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itext-xtra</artifactId> <version>5.5.12</version> </dependency> <dependency> <groupId>com.itextpdf.tool</groupId> <artifactId>xmlworker</artifactId> <version>5.5.12</version> </dependency> </dependencies> </project>
The next step is download.sh 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 download.sh The file will do.
You can also download.sh 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.