美文网首页
MavenJavaWeb相关设置记录

MavenJavaWeb相关设置记录

作者: lllaser | 来源:发表于2017-08-25 01:12 被阅读0次

修改编码集

Eclipse中,项目Properties(Alt+Enter) - Resource,Other中修改编码为UTF-8

错误[Dynamic Web Module 3.1 requires Java 1.7 or newer]

Java版本

Properties - Java Build Path - Libraries 修改jre版本
Properties - Java Compiler 修改编译版本

Project Facets配置

Properties - Project Facets
但Dynamic Web Module 2.3无法配置,需要从操作系统中打开工程目录,.settings文件夹中的org.eclipse.wst.common.project.facet.core.xml,内容如下

<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
  <fixed facet="wst.jsdt.web"/>
  <installed facet="jst.web" version="3.1"/>
  <installed facet="wst.jsdt.web" version="1.0"/>
  <installed facet="java" version="1.8"/>
</faceted-project>

相应位置中修改web版本和java版本

但是修改后可能会发现错误仍然没消除,或在Maven - Update Project后又变回原样,那么需要在pom.xml中添加plugin

pom.xml

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

然后进行Maven - Update Project

missing artifact错误

原因:缺少相应的jar
解决方法:项目运行为maven,clean package

相关文章

网友评论

      本文标题:MavenJavaWeb相关设置记录

      本文链接:https://www.haomeiwen.com/subject/mbmydxtx.html