maven manually add third-party jar package

wrote
PS: Today a friend sent me the maven web project and asked me to run down. When I started jetty, there were several jars, but I couldn’t find them. It was very frustrating. I solved it by the methods provided below.

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

Xml code   Favorite code
  1. <dependency>   
  2.    <groupId>net.sf.saxon</groupId>   
  3.    <artifactId>saxon-dom</artifactId>   
  4.    <version>9.0</version>   
  5. </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)

Xml code   Favorite code
  1. <dependency>  
  2.         <groupId>com.adobe.flex.compiler</groupId>  
  3.         <artifactId>asdoc</artifactId>  
  4.         <version>3.2.0.3958</version>  
  5.         <classifier>template</classifier>  
  6. </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"

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326178159&siteId=291194637