打开maven官网下载maven,本次演示使用的是maven-3.5.0

maven官网下载链接

1>下载之后首先要配置环境变量,和java配置环境变量一致。配置不多介绍,不会配置的推荐以下博客查看

配置环境变量博客

重要的settings.xml配置,在安装的maven,conf文件目录下

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><localRepository>D:\repository</localRepository><pluginGroups>  </pluginGroups><proxies>   </proxies><servers></servers><mirrors><mirror><id>nexus-aliyun</id><mirrorOf>central</mirrorOf><name>Nexus aliyun</name><url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror>  </mirrors><profiles><profile>     <id>jdk1.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></settings>
2>使用idea 进行设置



-DarchetypeCatalog=internal
设置好之后创建maven下的web工程


0000000000000000000000000000000000 点击下一步0000000000000000000000000000000000000

创建好模块,就要导入jar包

在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>day8_14</artifactId><version>1.0-SNAPSHOT</version><packaging>war</packaging><name>day8_14 Maven Webapp</name><!-- FIXME change it to the project's website --><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>
<!--         jar包           --><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency><dependency><groupId>javax.servlet</groupId><artifactId>javax.servlet-api</artifactId><version>3.0.1</version><scope>provided</scope></dependency><dependency><groupId>javax.servlet.jsp</groupId><artifactId>jsp-api</artifactId><version>2.0</version><scope>provided</scope></dependency></dependencies>
<!--       插件         --><build><finalName>day8_14</finalName>
<!--    <pluginManagement>&lt;!&ndash; lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) &ndash;&gt;--><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>1.8</source><target>1.8</target><encoding>UTF-8</encoding></configuration></plugin><!--  tomcat 插件  --><plugin><groupId>org.apache.tomcat.maven</groupId><artifactId>tomcat7-maven-plugin</artifactId><version>2.2</version><configuration><port>8080</port><path>/</path></configuration></plugin><plugin><artifactId>maven-clean-plugin</artifactId><version>3.1.0</version></plugin><!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --><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>
运行测试

打开网页

http://localhost:8080/结果

关于maven的创建简单的servlet相关推荐

  1. Maven一:maven的下载和环境安装以及创建简单的Maven项目

    1.Maven的下载 地址:https://maven.apache.org/download.cgi 2.将下载下来的文件解压到某个目录,如:C:\soft\Maven\apache-maven-3 ...

  2. 在eclipse上使用Maven创建简单项目

    1.鼠标右键New -> Project -> Maven -> Maven Project 2.勾选 "Create a simple project( skip arc ...

  3. springmvc +bootstrap创建简单web项目

    本篇文章,我们会教你通过maven和spring mvc + bootstrap创建一个Java web项目的欢迎页.关于maven如何创建Java web项目,上一篇文章已经作了说明. 开始构建项目 ...

  4. 如何使用 Maven 来创建项目(一篇文章就够了)

    如何使用 Maven 来创建项目(一篇文章就够了) 1. Maven 简介 1. 简介 2. 项目构建 3. 项目构建工具 2. Maven 的四大特性 1. 依赖管理系统 版本号规范 2. 多模块构 ...

  5. Eclipse中spring boot的安装和创建简单的Web应用

    1.添加STS插件 方法一 1.Help -> Eclipse Marketplace- 2.选择"Popular"标签去查找Spring Tool Suite (STS) ...

  6. java servlet例子_Servlet学习教程(三)---- 一个简单的Servlet例子

    我们用个最简单的Servlet例子来解说一下Servlet简单配置以及Servlet类实现类的写法. 第一,我们新建一个Dynamic Web Project,起名Servlet 点击NEXT,设置D ...

  7. tomcat(2)一个简单的servlet容器

    [0]README 0.1)本文部分文字转自 "深入剖析Tomcat",旨在学习  一个简单的servlet容器  的基础知识: 0.2)for complete source c ...

  8. Maven - 快速创建Java工程和Web工程

    Maven - 快速创建Java工程和Web工程 [1]通过Eclipse创建Java工程 - - New - Maven Project 第一种- - 创建简单工程 填写坐标 第二种- -不使用简单 ...

  9. Maven STS创建WEB项目

    Maven  STS创建WEB项目 1,首先个人习惯先配置基础环境   window -> perferences 配置TEXT编码 配置JDK环境1.7 配置MAVEN环境 引入MAVEN3. ...

最新文章

  1. 如何用TF Object Detection API训练交通信号灯检测神经网络?
  2. matlab中print、fprintf、scanf、disp函数简要语法介绍
  3. 音频处理一:(音频基本信息)
  4. 隐私与机器学习,二者可以兼得吗?
  5. php执行先后顺序_PHP程序执行的过程原理
  6. ubuntu mysql 5.7 远程_ubuntu16.0.4安装mysql5.7以及设置远程访问
  7. mediarecoder 安卓_android 通过MediaRecorder实现简单的录音示例
  8. Illustrator 教程,如何在 Illustrator 中重新塑造文本?
  9. Python基础知识之面向对象编程
  10. LaTeX 长表格处理方法
  11. TIG:一款威胁情报收集小工具
  12. 进销存excel_excel进销存管理系统
  13. Android使用Zxing库生成PDF417扫描后多一个字符A
  14. DirectShow笔记
  15. Android 系统分析工具:Systrace
  16. 聋校计算机教学案例,聋校汉语拼音b、p的教学案例
  17. 饮水机和水桶图解RAID方式,强烈推荐
  18. 实现memcmp函数
  19. drupal建站案例_10分钟利用Drupal快速搭建网站
  20. 数据结构中的有序和无序

热门文章

  1. 极客巅峰2021 web opcode
  2. 网络隔离变压器的选型
  3. Atitit 二维码和条码的历史发展 1.发展历程 编辑提及二维码的诞生,我们还得倒回至上个世纪 60 年代之后的日本,虽然 1945 年的第二次世界大战之中日本沦为战败国,可是在经济方面日本却进入
  4. 【微信小程序】一文带你吃透小程序开发框架——视图层中的事件系统
  5. 半小时实现Java手撸Http协议,爽!!(附完整源码,建议收藏)
  6. python实现图片上打印文字
  7. 普罗米修斯?古希腊泰坦之神?异形?不,新一代企业级监控组件—Prometheus
  8. onmouseover事件中把鼠标变成小手形状
  9. Word文档中插入的图片显示不全、嵌入式图片显示不全解决方法,仅设置图片为单倍行距方法
  10. C4996:'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead.