打包运行maven项目的时候报错NoClassDefFoundError

java.lang.NoClassDefFoundError: com/pdd/pop/sdk/http/PopBaseHttpRequest
 at java.lang.Class.getDeclaredConstructors0(Native Method) ~[na:1.8.0_242]
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671) ~[na:1.8.0_242]
 at java.lang.Class.getDeclaredConstructors(Class.java:2020) ~[na:1.8.0_242]
 at org.springframework.boot.context.properties.ConfigurationPropertiesBindConstructorProvider.findConstructorBindingAnnotatedConstructor(ConfigurationPropertiesBindConstructorProvider.java:62) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.boot.context.properties.ConfigurationPropertiesBindConstructorProvider.getBindConstructor(ConfigurationPropertiesBindConstructorProvider.java:48) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.boot.context.properties.ConfigurationPropertiesBean$BindMethod.forType(ConfigurationPropertiesBean.java:311) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.validate(ConfigurationPropertiesBeanDefinitionValidator.java:63) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.boot.context.properties.ConfigurationPropertiesBeanDefinitionValidator.postProcessBeanFactory(ConfigurationPropertiesBeanDefinitionValidator.java:45) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:286) ~[spring-context-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
 at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:174) ~[spring-context-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
 at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.4.RELEASE.jar!/:5.2.4.RELEASE]
 at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]
 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.5.RELEASE.jar!/:2.2.5.RELEASE]

这里仅仅争对我个人的问题:
我在项目中添加上了本地的jar包依赖,而忘记配置打包相关的内容

解决方案:
在pom.xml中的build下添加以下配置:
        <resources>
            <resource>
                <directory>jar</directory>
                <targetPath>/BOOT-INF/jar/</targetPath>
                <includes>
                    <include>**/*.jar</include>
                </includes>
            </resource>
        </resources>

本博客所有文章如无特别注明均为原创。作者:倪风复制或转载请以超链接形式注明转自 CodeTip技术博客
原文地址《打包运行maven项目的时候报错NoClassDefFoundError
分享到:更多

相关推荐

发表评论

路人甲 表情
Ctrl+Enter快速提交

网友评论(0)