How do I add a local JAR package to a local Maven warehouse

  • 2020-06-23 02:22:24
  • OfStack

How do I add a local JAR package to a local Maven warehouse

Sometimes, when we need to add a definite jar to our maven project and find that the Maven central repository does not exist, but we have the required jar package in our hands, we can be self-sufficient and add the jar package to our own maven repository for easy reference in the maven project.

For example, sqljdbc. jar cannot be found in the Maven central repository, but our maven project does need one such jar package. Then we need to download the corresponding version of sqljdbc. jar package locally and then add it to the local repository as follows. (ps: If you have downloaded and configured maven)

1, enter the path of sqljdbc4.jar packet, such as /root/ sqljdbc4.jar

2, the execution has been ordered


mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 \ 
-Dpackaging=jar


3. You can then add to the ES37en.xml file under your own maven project


<dependency>
   <groupId>com.microsoft.sqlserver</groupId>
   <artifactId>sqljdbc4</artifactId>
   <version>4.0</version>
</dependency>


If you have any questions, please leave a message or go to this site community exchange discussion, thank you for reading, hope to help you, thank you for your support to this site!


Related articles: