SoFunction
Updated on 2025-03-05

springboot: Implementation method of loading local jars to maven

In Spring Boot project, if you want to load a local jar file into the Maven local repository, you can use Maven'sinstall-fileGoals are achieved. Here is a simple example:

  • Open a command line tool (for example: terminal or command prompt).
  • Run the following Maven command to install your local jar file to the Maven local repository:
mvn install:install-file -Dfile=<> \
-DgroupId=<your-group-id> \
-DartifactId=<your-artifact-id> \
-Dversion=<your-version> \
-Dpackaging=jar

Replace the above command<>For the actual path to your jar file,<your-group-id><your-artifact-id><your-version>Information about your project.

For example, if you have a nameeasyAi-1.2.The jar file and the jar package is stored in D:/maven/jar/easyAi-1.2. and if you want to install it into the Maven local repository, you can do this:

mvn install:install-file -Dfile=D:/maven/jar/easyAi-1.2. \
-DgroupId= \ 
-DartifactId=dromara \
-Dversion=1.0.0 -Dpackaging=jar

After the installation is complete, you can use theAdd this jar to the file like any other Maven dependencies:

<dependency>
     <groupId></groupId>
     <artifactId>dromara</artifactId>
     <version>1.0.0</version>
</dependency>

Make sure your Spring Boot project isThere is a correct Maven repository configuration in the file so that Maven can correctly parse and download dependencies.

This is the article about springboot loading local jars to maven. For more related springboot loading local jars, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!