打war包报错

打war包报错

http://img1.sycdn.imooc.com//climg/5ec10faf0930d22214660148.jpg

http://img1.sycdn.imooc.com//climg/5ec10faf098b021d03610090.jpg

http://img1.sycdn.imooc.com//climg/5ec10faf0967770414660148.jpg

先是出现错误让update maven然后更新之后jre就变回1.5了,然后又重新把两个都设置成1.8,还是报错

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,Dynamic Web Module 3.1 requires Java 1.7 or newer

首先需要检查和确认Eclipse项目属性的java版本和本地jdk的版本一致,以1.7版本为例:

1. 在 Java Build Path的libraries中修改对应的JDK版本为1.7;

2.在Java Compiler 中修改对应的JDK版本为1.7;

3.在Project Facet中修改对应的JDK版本为1.7;

4.如果以上修改后还是报错。是因为使用了 maven构建,所以最好在pom.xml文件中的build标签的plugins部分,加入以下代码:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <source>1.7</source>
        <target>1.7</target>
    </configuration>
</plugin>

5. 最后记得:因为修改了pom.xml,所以需要对项目进行Maven Update.

祝学习愉快~

  • 慕村9139682 提问者 #1
    老师,工程不报错了,但是运行插件还是错误:[INFO] Copying webapp resources [D:\eclipse-workspace\maven\src\main\webapp] [INFO] Webapp assembled in [336 msecs] [INFO] Building war: D:\eclipse-workspace\maven\target\maven-1.0.0-RELEASE.war [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.454 s [INFO] Finished at: 2020-05-17T19:44:43+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:3.2.3:war (default-war) on project maven: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    2020-05-17 19:48:13
  • 慕村9139682 提问者 #2
    好了老师,问题解决了~~谢谢!
    2020-05-17 19:53:57
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师