Sometimes some packages cannot be downloaded through maven. , or configure the local application jar in the local maven repository for us to use.
Reprint https://blog.csdn.net/joe_007/article/details/7564931
When using maven to build a project, it is unavoidable to load a large number of third-party jar packages and zip packages, which are rarely used, and the jars provided by maven's official website often cannot meet the needs. In this case, we need to manually load them into our local or nexus private server warehouse .
1. Load the jar package locally (take loading saxon-dom-9.0.jar as an example)
First add it to the pom.xml file of the project
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>9.0</version>
- </dependency>
After the pom.xml configuration is complete, execute the following commands:
mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon-dom -Dversion=9.0 -Dpackaging=jar -Dfile=/home/ubuntu/saxon-dom-9.0.jar
Note: -Dfile refers to the path of the third-party jar. Others should ensure that the groupId, artifactId, version in the maven command are the same as the configuration in pom.xml, and -Dpackaging indicates the type of loaded file
2. Load the zip package locally (take loading asdoc-3.2.0.3958-template.zip as an example)
- <dependency>
- <groupId>com.adobe.flex.compiler</groupId>
- <artifactId>asdoc</artifactId>
- <version>3.2.0.3958</version>
- <classifier>template</classifier>
- </dependency>
After the pom.xml configuration is complete, execute the following commands:
mvn install:install-file -DgroupId=com.adobe.flex.compiler -DartifactId=asdoc -Dversion=3.2.0.3958 -Dclassifier=template -Dpackaging=zip -Dfile=/home/ubuntu/asdoc-3.2.0.3958-template.zip
Description: Loading a zip package is basically the same as loading a jar, pay attention to the type of the loaded file "-Dpackaging"