微服务 教程
1085个小节阅读:195.6k
C语言快速入门
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
pom文件最上方是项目基本信息:
groupId
groupId一般定义项目组名,命名规则使用反向域名。例如com.itbaizhan
artifactId
artifactId一般定义项目名,命名使用小写字母。项目发布后,它的坐标是groupId+artifactId。
version
version定义版本号。版本号一般有三段,第一段:革命性的产品升级。第二段:新功能版本。第三段:修正一些bug。
packaging
packaging定义打包方式。
<properties>
中定义一些配置信息:
<dependencies>
中定义依赖的jar包坐标:
由于项目是web项目,需要写Servlet和JSP,所以需要引入Servlet和JSP的依赖。查找依赖坐标的网站:https://mvnrepository.com/
xxxxxxxxxx
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- jsp -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<!-- servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
为什么之前的web项目中没有引入jsp和servlet的jar包?
因为之前项目中使用的是tomcat中的jsp和servlet中的jar包,在项目中没有引入。
<plugins>
中定义第三方插件:
web项目依赖tomcat运行,所以添加tomcat7插件
xxxxxxxxxx
<plugins>
<!-- tomcat插件 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
<server>tomcat7</server>
</configuration>
</plugin>
</plugins>
1. 在Maven项目的pom文件中,使用定义引入的依赖
A <plugin>
B <properties>
C <dependency>
D <version>
2. 在Maven项目的pom文件中,使用定义引入的插件
A <plugin>
B <properties>
C <dependency>
D <version>
1=>C 2=>A