SpringBoot cannot find the class file in the custom external jar package when the idea is packaged and generated by the maven tool

            Today, when using the idea tool to package the maven project in the project, due to the use of an external custom jar package, an error is reported when the jar package of the package is generated. The error shows that the class class in the custom jar package is missing, here It is the springboot test project used. Dynamically loaded beans are used in the project. For the dynamic loading of beans, please refer to the previous article http://357029540.iteye.com/blog/2389375 . After searching for a long time, I did not find the reason. There is an external import package under the lib folder, but an error is still reported. Later, when the generated jar package is opened, it is found that the reference to the custom external jar package is missing from the class-path of the MANIFEST.MF file in the original META-INF folder. , after adding the reference to the external jar package, no error will be reported. As for why the reference to the outsourced jar is missing when packaging, no specific reason has been found.

       The way to externally introduce local jars (not below .m2) is:

 

<dependency>
     <groupId>com.dynamic</groupId>
     <artifactId>testDynamicBean</artifactId>
     <version>1.0</version>
     <scope>system</scope>
     <systemPath>f:/testDynamicBean-1.0-SNAPSHOT.jar</systemPath>
</dependency>
      If you do not want to use the import method of the local jar package, that is, package it under .m2 and then import it and do not use it
<scope>system</scope>
<systemPath>f:/testDynamicBean-1.0-SNAPSHOT.jar</systemPath>
 This part of the configuration, we can use mvn install:install-file -Dfile= f:/testDynamicBean-1.0-SNAPSHOT.jar -DgroupId  = com.dynamic -DartifactId  = testDynamicBean  -Dversion=1.0 -Dpackaging=jar -DgeneratePom=true - DcreateChecksum=true way to execute the jar to the .m2 directory can be used directly as follows:
<dependency>
     <groupId>com.dynamic</groupId>
     <artifactId>testDynamicBean</artifactId>
     <version>1.0</version>
</dependency>
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326995158&siteId=291194637