在创建maven web项目事遇到的问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hsl_1990_08_15/article/details/79862864

1、右键 maven--》update project...

1.1)报错:

Cannot change version of project facet Dynamic Web Module to 3.1

解决方法:打开Navigator视图,找到.settings-->org.eclipse.wst.common.project.facet.core.xml

<installed facet="jst.web" version="3.1"/>

1.2)报错:

One or more constraints have not been satisfied

解决方法:打开pom.xml文件添加如下内容

<profiles>
  	<profile>
        <id>jdk-1.8</id>
        <!-- 另外一种激活方式 -->
        <activation>
            <activeByDefault>true</activeByDefault>
            <jdk>1.8</jdk>
        </activation>
        <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
			<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
        </properties>
    </profile>
  </profiles>

2、编译maven项目

2.1)报错:

org.codehaus.plexus.archiver.ArchiverException: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

<build>
    <finalName>web</finalName>
    <plugins>
	    <plugin>
	        <groupId>org.apache.maven.plugins</groupId>
	        <artifactId>maven-war-plugin</artifactId>
	        <version>2.1.1</version>
	        <configuration>
	              <webXml>web\WEB-INF\web.xml</webXml>
	        </configuration>
	    </plugin>
	</plugins>
  </build>

2.2)编译后,运行项目报:The import XXX cannot be resolved

引用的报名都存在,就是找不到

解决办法:project-->clean






猜你喜欢

转载自blog.csdn.net/hsl_1990_08_15/article/details/79862864