我是靠谱客的博主 老实泥猴桃,最近开发中收集的这篇文章主要介绍如何使用idea搭建一个web项目,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

第一种我们可以使用maven的模板

将web.xml中改为

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
</web-app>

pom.xml中注释掉的部分都可以删除

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>djskd</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<!--
<name>djskd Maven Webapp</name>-->
<!--
&lt;!&ndash; FIXME change it to the project's website &ndash;&gt;-->
<!--
<url>http://www.example.com</url>-->
<!--
<properties>-->
<!--
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
<!--
<maven.compiler.source>1.7</maven.compiler.source>-->
<!--
<maven.compiler.target>1.7</maven.compiler.target>-->
<!--
</properties>-->
<!--
<dependencies>-->
<!--
<dependency>-->
<!--
<groupId>junit</groupId>-->
<!--
<artifactId>junit</artifactId>-->
<!--
<version>4.11</version>-->
<!--
<scope>test</scope>-->
<!--
</dependency>-->
<!--
</dependencies>-->
<!--
<build>-->
<!--
<finalName>djskd</finalName>-->
<!--
<pluginManagement>&lt;!&ndash; lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) &ndash;&gt;-->
<!--
<plugins>-->
<!--
<plugin>-->
<!--
<artifactId>maven-clean-plugin</artifactId>-->
<!--
<version>3.1.0</version>-->
<!--
</plugin>-->
<!--
&lt;!&ndash; see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging &ndash;&gt;-->
<!--
<plugin>-->
<!--
<artifactId>maven-resources-plugin</artifactId>-->
<!--
<version>3.0.2</version>-->
<!--
</plugin>-->
<!--
<plugin>-->
<!--
<artifactId>maven-compiler-plugin</artifactId>-->
<!--
<version>3.8.0</version>-->
<!--
</plugin>-->
<!--
<plugin>-->
<!--
<artifactId>maven-surefire-plugin</artifactId>-->
<!--
<version>2.22.1</version>-->
<!--
</plugin>-->
<!--
<plugin>-->
<!--
<artifactId>maven-war-plugin</artifactId>-->
<!--
<version>3.2.2</version>-->
<!--
</plugin>-->
<!--
<plugin>-->
<!--
<artifactId>maven-install-plugin</artifactId>-->
<!--
<version>2.5.2</version>-->
<!--
</plugin>-->
<!--
<plugin>-->
<!--
<artifactId>maven-deploy-plugin</artifactId>-->
<!--
<version>2.8.2</version>-->
<!--
</plugin>-->
<!--
</plugins>-->
<!--
</pluginManagement>-->
<!--
</build>-->
</project>

第二种我们不使用maven模板

 

区别是不使用模板建的项目的web目录不在src中。最好使用maven模板

 

最后

以上就是老实泥猴桃为你收集整理的如何使用idea搭建一个web项目的全部内容,希望文章能够帮你解决如何使用idea搭建一个web项目所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(62)

评论列表共有 0 条评论

立即
投稿
返回
顶部