The SpringBoot project depends on the local jar package

1. The source of the problem

When we build projects, we often need to use local jar packages. I believe that you can find many ways of writing maven relying on local jar packages on the Internet, and they have been successfully started. However, when we package the project as a jar package or war package and deploy it to the server, an error may be reported when it is started, and a bunch of errors such as class not found and dependencies may be reported. We will solve such a problem next.

 

2. Add the local jar package to the local warehouse

Our better solution now is to add the local jar package to the local warehouse:

Maven adds local jar packages:

mvn install:install-file -Dfile=jar package location -DgroupId=groupId above -DartifactId=artifactId above -Dversion=version above -Dpackaging=jar

For example, writing in the Intellij command line:

mvn install:install-file -Dfile=D:\HelloWorld.jar -DgroupId=com.test -DartifactId=HelloWorld -Dversion=1.0-SNAPSHOT -Dpackaging=jar

After success we can see

Then, we add dependencies to pom.xml

Reprinted from: https://blog.csdn.net/qq_33443402/article/details/100573227

Guess you like

Origin blog.csdn.net/wml00000/article/details/108727299