以前觉了maven依赖设置很简单,就是将手动导入jar包转化为自动下载导入

但发现的一个问题,

在使用maven插件tomcat打包上传工具时

tomcat-maven-plugin
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin> <!-- tomcat远程部署 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<url>http://ip:端口/manager/text</url>
<path>/项目名</path>
<username>xxxx</username>
<password>xxx</password>
<server>tomcat</server>
<update>true</update>
</configuration>
</plugin> </plugins>
</pluginManagement>
</build>

老是出现可以上传war包到服务器,但就是启动不了

就一步步排查问题,找了一大堆,最后我是靠注释掉所有启动时的配置代码,尝试着终于找到问题

问题代码AppConfig.java

        //添加全局的小程序配置
WxaConfig wc = new WxaConfig();
wc.setAppId(PropKit.get("wxaappId"));
wc.setAppSecret(PropKit.get("wxaappSecret"));
WxaConfigKit.setWxaConfig(wc);

在pom.xml中我的错误依赖代码

        <dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal-weixin</artifactId>
<version>1.9</version>
<scope>provided</scope>
</dependency>

我使用的是较新版本的jfinal-weixin-1.9.jar包

而服务器上/usr/local/tomcat/lib目录下的是jfinal-weixin-1.8.jar的jar包

旧版本没有该对应代码,所以就启动不成功了,但奇怪的是我查看tomcat的日志文件却没有明显错误提示,只是说

SEVERE: One or more listeners failed to start.

这个查看详细日志在哪看,这个都不知道,百度也找不到,烦躁

搜索的下,这个

<scope>provided</scope> <!-- compile:开发环境, provided:部署环境 -->

如果是provided时,这个jar包是不会被编译到war包的WEB-INF/lib目录下,项目就会用tomcat/lib目录下的jar包,

      compile,缺省值,适用于所有阶段,会随着项目一起发布。
* provided,类似compile,期望JDK、容器或使用者会提供这个依赖。如servlet.jar。
* runtime,只在运行时使用,如JDBC驱动,适用运行和测试阶段。
* test,只在测试时使用,用于编译和运行测试代码。不会随项目发布。
* system,类似provided,需要显式提供包含依赖的jar,Maven不会在Repository中查找它。

将该依赖改为下面的,重新编译上传。终于搞定了,为自己的无知又添加了一笔

        <dependency>
<groupId>com.jfinal</groupId>
<artifactId>jfinal-weixin</artifactId>
<version>1.9</version>
<scope>compile</scope>
</dependency>

给一个图吧

最新文章

  1. [.net 面向对象程序设计进阶] (19) 异步(Asynchronous) 使用异步创建快速响应和可伸缩性的应用程序
  2. iOS开发之XCode设置--消除AFN的警告
  3. Thoughtful function is also good for investigation
  4. JavaScript添加、查找、删除元素的一个实例
  5. php 执行linux 命令函数
  6. Leetcode:find_minimum_in_rotated_sorted_array
  7. java第十二次作业
  8. Google Interview University 一套完整的学习手册帮助自己准备 Google 的面试
  9. Hello——Java10新特性,请了解一下
  10. python字典作为统计记录工具
  11. Luogu1627 [CQOI2009]中位数
  12. 快速傅里叶变换(Fast Fourier Transform, FFT)和短时傅里叶变换(short-time Fourier transform,STFT )【资料整理】【自用】
  13. textarea 固定大小,滚动条,限制拖动,文字对齐
  14. SAP本地化-银企直连
  15. 【教程】手写简易web服务器
  16. CSS中如何选择ul下li的奇数、偶数行
  17. lambda函数详解
  18. hibernate关联关系
  19. 如何使用Flash抓抓狂抓取网页Flash
  20. Step By Step Hibernate Tutorial Using eclipse WTP[z]

热门文章

  1. jvm不打印异常栈
  2. POJ3045 Cow Acrobats 2017-05-11 18:06 31人阅读 评论(0) 收藏
  3. sublime text 插件 -- 获取文件名到剪贴板
  4. 通过css使用background-color为背景图添加遮罩效果
  5. C#判断本地文件,网络文件是否存在是否存在
  6. leetcode 缺失数字
  7. Win(Phone)10开发第(7)弹,Extended Execution
  8. Linux中目录proc/net/dev详解
  9. idea破解方式 附jar包
  10. CentOS IPv6设置