spring-boot-maven-plugin package install local jar

problem appear

When using spring-boot-maven-plugin, execute mvn install the default installation package that can perform jar, unzip the following figure, the relevant file will be placed BOOT-INF inside, this time, the introduction of other projects, tips I can not find the class.


image.png

At this time, the same source project into a ecplise in the event of the maven dependencies in a directory, rather than expecting a jar file, as shown below


image.png

This time, the introduction of direct run this jar package engineering, project no problem, but when executed mvn package jar package introduced this project, there will not find the appropriate class file, therefore, this method can only be compiled in debug when we can adopt this method.

Less formal environment, or just want to provide a jar contracted with third parties, but also how does it work?
This time, we need to use the following naming to address, as follows:

Solving steps

Careful friends can be found in spring boost in the targetnext two jar files and directories, one .jar, one .jar.original, which is the .jar jar package can be executed, the default will install the package to a local warehouse, this time there will be other projects , can not find the relevant class, if you need to provide additional engineering, can not use this jar package, you should use .jar.originala jar.

image.png

There are two specific practices :( recommend the first)

First, use the command to install

You need to install the package into the jar: GMTP-1.0.0.jar.originaldirectory
execute the following command to install:

mvn install:install-file -Dfile=GMTP-1.0.0.jar.original -DgroupId=com.prettylearn -DartifactId=GMTP -Dversion=1.0.0 -Dpackaging=jar

Note: The
above command various parameters important to be consistent with the corresponding values of pom.xml

image.png
-Dfile=GMTP-1.0.0.jar.original 需要安装的jar包
-DgroupId=com.prettylearn 对应的groupId
-DartifactId=GMTP  对应的:artifactId
-Dversion=1.0.0 对应的:version 
-Dpackaging=jar 对应的:packaging

You can also write command .bator .shfile can be run directly.

Second, use the eclipse maven install installation

In this case, the local repository has been installed in an executable jar package file. This time, we just replace the jar package file.
Specific steps:
1. GMTP-1.0.0.jar.originalChange the name to GMTP-1.0.0.jar
locate the local repository corresponding to positions 2, direct replacementGMTP-1.0.0.jar

Original Address: https: //www.jianshu.com/p/bcf627a409f2

Guess you like

Origin www.cnblogs.com/jpfss/p/12040728.html