How to type a SpringBoot project into a jar package that can be imported into other projects? according to the official tutorial, it is invalid to import jar into other projects.

the format of the self-packaged jar is inconsistent with that of the introduced jar. For some reason, the imported jar, does not work properly.
clipboard.png
clipboard.png

Mar.30,2021

you may need to:
1. Remove some unwanted files, such as Application and ApplicationTests
2. Do not use springboot to pack your own package, but use normal maven to package

.
<build>
   <plugins>
      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
            <source>1.8</source>
            <target>1.8</target>
         </configuration>
      </plugin>
   </plugins>
</build>

Note: spring-boot-maven-plugin is packaged and bug appears. Although the destination project references the packaged project, the class in jar cannot be referenced, because the first-level directory packaged by springboot-maven-plugin is Boot-INF, and cannot be referenced

Note-1. Test scope means that the test scope is valid and this dependency is not used when compiling and packaging

Note-2. Compile scope means that the compilation scope is valid, and dependencies are stored in both compilation and packaging

Note-3, provided dependency: it is valid in the process of compilation and testing, and will not be added when generating war packages, such as servlet-api, because web servers such as servlet-api,tomcat already exist, and conflicts will occur if you repackage.

Note-4. Runtime depends on it at run time, but not on

at compile time.

Note-5: add the local Maven path, similar to:

C:\Users\ofcard\.m2\repository\com\scn7th\ding-robot-bind-send\0.0.1-SNAPSHOT>mvn install:install-file -Dfile=ding-robot-bind-send-0.0.1-SNAPSHOT.jar -DgroupId=com.scn7th -DartifactId=ding-robot-bind-send -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

reference:
package a project into a jar package. Import into another project and call
Gradle to build SpringBoot and package runnable jar configuration
springboot packaged as jar file does not work properly. A solution has been found
introducing other spring boot projects into the spring boot project (maven)


spring-boot projects cannot be packaged with spring-boot plug-ins if they need to be "packaged for other projects". Package
is used by default, but the jar package after this cannot be java-jar run

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9f9c3-1a6f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9f9c3-1a6f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?