maven依赖,启动NoClassDefFoundError

2023-06-19  本文已影响0人  我是光芒万丈

原因:pom中使用了system:

    <dependency>
      <groupId>anysign</groupId>
      <artifactId>components</artifactId>
      <version>2.0.0</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/src/main/resources/lib/anysign-components-2.0.0.jar</systemPath>
    </dependency>

maven中scope详细说明如下:https://www.cnblogs.com/powerwu/articles/16146108.html
简而言之:system几乎与provided作用域相同,打包不会将依赖打包到jar包中。
解决:
增加以下配置

         <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>

全部配置如下:

            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
上一篇 下一篇

猜你喜欢

热点阅读