首页 > 编程知识 正文

maven打包没有把依赖包打进jar,maven依赖的包没有打进去

时间:2023-05-04 19:06:28 阅读:25148 作者:2662

使用IDEA在tomcat中部署maven多模块时出现的令人费解的错误

首先用服务器打印。 可以看到上下文[ ] startupfailedduetopreviouserror,see server log for details。

[ 2018-10-191033605336028,273 ] artifact spring MVC-test : war exploded : artifactisbeingdeployed, pleasewait.] 201810336055336029 am org.Apache.catalina.startup.tldconfigexecuteinfo : atleastonejarwasscannedfortldyetcontainedned bbned etelistofjarsthatwerescannedbutnotldswerefoundinthem.skippingunneededjarsduringscanningcanim provestartuptimeandjspcompilatiotion ad class ' org.slf4j.impl.staticloggerbinder '.sl f4j 3360 deeer nop ) loggerimplementationslf 4j 3360 see http://www.slf4j . staticloggerbinderforfurtherdetails.oct 19, 201810336055336030 am org.Apache.catalina.core.standardcontextstartinternalsevere 3360 oneormorelistenersfailedtostart fount leoct19, 201810:55:30 am org.Apache.catalina.core.standardcontextstartinternalsevere 3360 context [ ] startupfailedduetopreviouserrors [ 2018-10-191033605336030, 410 ) artifact spring MVC-test : war exploded : errorduringartifactdeployment.seeserverlogfordetails.oct 19, 201810336055:38 am org.Apache.catalina.startup.hostconfigdeploydirectoryinfo :部署webapplicationdirectory/3360部署webaplicati Apache-Tomcat-7.0.90/web apps/manager oct 19, 201810336055336038 am org.Apache.catalina.startup.tldconfigexecuteinfo : atleastonejarwasscannedfortldyetcontainedned bbned etelistofjarsthatwerescannedbutnotldswerefoundinthem.skippingunneededjarsduringscanningcanim provestartuptimeandjspcompilatiotion 201810:55:38 am org.Apache.catalina.startup.hostconfigdeploydirectoryinfo : deploymentofwebapplicationdirectorector

然后打开tomcat日志的位置,显示框架- base的ConfigItem NotFound。

zwj @ Ubuntu ://.intellij idea 2018.1/system/Tomcat/unnamed _ learn/logs $ ls catalina.2018-10-18.log localhost _ access _ log.2018-10-17.txt catalina.2018-10-19.loglocalocalocalhlhalholhost 18-10-19.log manager.2018-10-18.loglocalhoog 2018-10-19.logorg.spring framework.beans.factory.canotle ss ] forbeanwithname ' com.zwj.framework.base.config.config item #0' definedinclasspathresource [ spring/aplication ] nestedexceptionisjava.lang.classnotfoundexception : com.zwj.framework.base.config.config item

war包下的lib中仍然没有框架- base、springwork-mybatis等子模块的jar包:

显然,当您使用idea单击tomcat运行时,在编译打包过程中我们的子模块是否丢失了? 带着问题继续看IDEA的日志。

zwj @ Ubuntu :~$ CD.intellij idea 2018.1/system/log/zwj @ Ubuntu :~. intellij idea 2018.1/system/log $ ls build-log idea.log.2 idea.log.5 idea.log idea.log.3 thread dumps-freeze-2018 10 16-152806-iu-181.551 log $ tail-fidea.log com.intellij.execution.execution exception : cannot load/home target/artifacts/spring MVC _ tion home/zwj/learn/learn/spring spring MVC _ test _ war _ exploded/meta-INF/context.XML (nosuchfileordirectory ) atorg.jetbrains.idea.Tomcat.Tomcat util.loadxml file (Tomcat util.Java :208 ) atorg.jetbrains.idea.Tomcat.Tomcat util.findcontextincontextxml (Tomcat util.Java 3360107 ) atorg.jetbrains.idea atorg.jetbrains.idea.Tomcat.admin.tomcatadminlocalserverimpl.addaplicationcontext (

百度半天后,我们发现没有加载此context文件不是错误的根源,而是子模块的jar包未导入时发生的子错误。

幸运的是,最终发现了错误。 查看下图中artifacts的lib中没有子模块的jar包,首先单击lib,在available elements的中点打开相应的模块,然后单击

打包Into进入。

最后点击运行就可以了。

洞。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。