无法通过file-》new找到marven project
配置方法
点击MyEclipse的Window>>Customize Perspective>>Menu Visibility>>File >>New找到marven project点击ok
xml顶部错误
Cannot detect Web Project version. Please specify version of Web Project through <version> configuration property of war plugin. E.g.: <plugin> <artifactId>maven-
war-plugin</artifactId> <configuration> <version>3.0</version> </configuration> </plugin>
那是因为项目未指定maven war编译插件的错误
解决方法如下:
在pom.xml文件中加入:
<build>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<version>3.0</version>
</configuration>
</plugin>
</plugins>
<finalName>webserver</finalName>
</build>
myeclipse默认webapp项目的jre版本是4.4或者4.5
方法1、在项目的pom.xml中添加
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
然后maven-》update project即可更新为1.8
方法2、在Maven的settings.xml文件中指定全局默认的Jdk版本
<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>
marven webapp项目jsp错误
The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
pom中添加以下内容即可
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
默认的骨架和web项目的骨架
web项目注意添加servlet依赖