How to import the jar package under lib when maven is packaged

The spring boot project is packaged and put in the Linux environment, and an error is reported
The error message is as follows;
Handler dispatch failed; nested exception is java.lang.NoClassDefFoundError: com/openapi/sdk/service
The reason is that the imported external jar package does not take effect
The location where the project references the external jar is as follows;

Insert picture description here

Introduce the code of the external jar in the pom file
<dependency>
			<groupId>com.chehuida</groupId>
			<artifactId>um-core</artifactId>
			<version>1.0.1</version>
		</dependency>
		<dependency>
        <groupId>com.test</groupId>
        <artifactId>test</artifactId>
        <scope>system</scope>
        <version>1.0</version>
        <systemPath>${
    
    project.basedir}/src/main/resources/lib/openapi-sdk.jar</systemPath>
    </dependency> 
When packaging, add these few lines of code to be OK, a perfect solution
<configuration>
        <includeSystemScope>true</includeSystemScope>
                </configuration>

		
		<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
        <includeSystemScope>true</includeSystemScope>
                </configuration>
            
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> 

Guess you like

Origin blog.csdn.net/qq_38220334/article/details/107858414