maven打war包遇到的错误

来源:互联网 发布:Apache 转发 跨域 编辑:程序博客网 时间:2024/04/28 12:18

错误症状:

1、myeclipse下直接用tomcat启动项目,没有问题,正常

2、maven打war包正常,但打的war包启动异常

3、用myeclipse里project-clean后打的war包启动正常

4、用myeclipse和tomcat打的war包均可正常启动

5、反编译maven打的war包,发现很多未定义错误

throw new Error("Unresolved compilation problems: \n\tThe import org.hibernate cannot be resolved\n\tCriterion cannot be resolved to a type\n");
解决方法:

看到很多未定义错误,跟源文件编译出来的都不一样,所以想到估计是编译的问题,网上查了很多很多

1、jdk版本不一致,编译,开发jdk不一样,更换后失败

2、修改jar包顺序,更换后失败

3、在pom.xml里添加编译路径,解决

  <plugin><artifactId>maven-war-plugin</artifactId><version>2.2</version><configuration><!-- web.xml路径 --><webXml>src/main/webapp/WEB-INF/web.xml</webXml><webappDirectory>src/main/webapp</webappDirectory><!-- war源文件路径 --><warSourceDirectory>src/main/webapp</warSourceDirectory><!-- war包名称 --><warName>${project.artifactId}</warName></configuration>  </plugin>


0 0
原创粉丝点击