前提:安装过maven并且配置了maven的环境变量,这里就不演示了。转载了别人一篇maven详解,不了解的可以先看一下这个 链接

图文讲解:

创建项目 选择Maven 选择创建webapp项目

指定groupid、artifactid及version

创建完成窗口:

但是我们发现项目结构里面缺少必要的文件夹:

创建我们的项目目录:

java目录 设置成 Sources Root

resources目录 设置成Resources Root

test目录设置成Test Sources Root

再创建包以及把一些项目需要的文件放进去 最后项目结构大致如下

上面这些创建项目目录文件夹的操作也可以这样创建:

配置tomcat  两种方式:

第一种:

第二种:直接在pom.xml中直接引入tomcat插件

  1. <build>
  2. <plugins>
  3. <plugin>
  4. <groupId>org.apache.tomcat.maven</groupId>
  5. <artifactId>tomcat7-maven-plugin</artifactId>
  6. <version>2.2</version>
  7. <configuration>
  8. <path>/mavenDemo</path>
  9. <port>8080</port>
  10. </configuration>
  11. </plugin>
  12. </plugins>
  13. </build>

运行tomcat访问index.jsp:   localhost:8080/mavenDemo/

除了这些 我们还需要引入自己所需要的项目依赖以及引入插件信息(pom.xml):

  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6.  
  7. <groupId>com.alex</groupId>
  8. <artifactId>mavenDemoProject</artifactId>
  9. <version>1.0-SNAPSHOT</version>
  10. <packaging>war</packaging>
  11.  
  12. <name>mavenDemoProject Maven Webapp</name>
  13. <!-- FIXME change it to the project's website -->
  14. <url>http://www.example.com</url>
  15.  
  16. <properties>
  17. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  18. <maven.compiler.source>1.7</maven.compiler.source>
  19. <maven.compiler.target>1.7</maven.compiler.target>
  20. </properties>
  21.  
  22. <!--引入项目依赖-->
  23. <dependencies>
  24. <dependency>
  25. <groupId>junit</groupId>
  26. <artifactId>junit</artifactId>
  27. <version>4.11</version>
  28. <scope>test</scope>
  29. </dependency>
  30. <!--jsp-->
  31. <dependency>
  32. <groupId>javax.servlet</groupId>
  33. <artifactId>jsp-api</artifactId>
  34. <version>2.0</version>
  35. <scope>provided</scope>
  36. </dependency>
  37. <dependency>
  38. <groupId>javax.servlet</groupId>
  39. <artifactId>servlet-api</artifactId>
  40. <version>2.5</version>
  41. </dependency>
  42. <dependency>
  43. <groupId>jstl</groupId>
  44. <artifactId>jstl</artifactId>
  45. <version>1.2</version>
  46. </dependency>
  47. <!--mysql,c3p0,dbutils-->
  48. <dependency>
  49. <groupId>mysql</groupId>
  50. <artifactId>mysql-connector-java</artifactId>
  51. <version>5.1.32</version>
  52. </dependency>
  53. <dependency>
  54. <groupId>c3p0</groupId>
  55. <artifactId>c3p0</artifactId>
  56. <version>0.9.1.2</version>
  57. </dependency>
  58. <dependency>
  59. <groupId>commons-dbutils</groupId>
  60. <artifactId>commons-dbutils</artifactId>
  61. <version>1.6</version>
  62. </dependency>
  63. </dependencies>
  64. <build>
  65. <plugins>
  66. <!-- java编译插件 -->
  67. <plugin>
  68. <groupId>org.apache.maven.plugins</groupId>
  69. <artifactId>maven-compiler-plugin</artifactId>
  70. <version>3.2</version>
  71. <configuration>
  72. <source>1.8</source>
  73. <target>1.8</target>
  74. <encoding>UTF-8</encoding>
  75. </configuration>
  76. </plugin>
  77. <!--&lt;!&ndash;配置maven中的tomcat&ndash;&gt;-->
  78. <!--<plugin>-->
  79. <!--<groupId>org.apache.tomcat.maven</groupId>-->
  80. <!--<artifactId>tomcat7-maven-plugin</artifactId>-->
  81. <!--<version>2.2</version>-->
  82. <!--<configuration>-->
  83. <!--<path>/mavenDemo</path>-->
  84. <!--<port>8080</port>-->
  85. <!--</configuration>-->
  86. <!--</plugin>-->
  87. </plugins>
  88. </build>
  89. </project>

IDEA创建Maven Web 项目的更多相关文章

  1. eclipse 创建maven web项目

    参考:http://www.cnblogs.com/hongwz/p/5456616.html eclipse 创建maven web项目

  2. eclipse创建maven web项目

    eclipse创建maven web项目: 1.安装eclipse maven插件 2.新建maven project选择webapp模板. 3.改造为maven文档结构. 4.添加项目的JAVAEE ...

  3. IDEA 创建Maven Web项目(图文版)

    前言:IDEA作为一款广泛使用的开发工具,无论是后台人员,还是前段工作者,都能在它上面发现它的魅力. IDEA提供了诸多项目模板,今天就以创建Maven Web项目作为示例,和大家一起分享: 第一步: ...

  4. Eclipse创建Maven Web项目 + 测试覆盖率 + 常见问题(2015.07.14——湛耀)

    Eclipse创建Maven web项目: 到此,并没有创建好,接下来一步步解决问题: 问题:无法创建src/main/java目录 解决: 右键项目选择[properties] 点击[OK] 问题: ...

  5. Java Web 入门(一)使用 Intellij IDEA 14.1.5 创建 Maven Web项目

    1.基础配置 1.1 安装 JDK1.7,配置系统变量:JAVA_HOME 和 Path 1.2 安装 Tomcat 7.0 1.3 安装  Intellij IDEA 14.1.5 1.4 Mave ...

  6. Intellij IDEA创建Maven Web项目

    1前言 在创建项目中,IDEA提供了非常多项目模板,比方Spring MVC模板,能够直接创建一个基于Maven的Spring MVC的demo,各种配置都已经设定好了,直接编译部署就能够使用. 最開 ...

  7. Eclipse创建Maven Web项目后更改Servlet版本

    Eclipse创建Maven Web项目后更改Servlet版本 1.场景基于Eclipse通过maven-archetype-webapp原型创建一个Web项目后,其默认Servlet版本是2.3, ...

  8. 解决使用eclipse创建maven web项目时报Could not resolve archetype的问题

    前两天重装了系统,今天想写一个项目的时候出现了点问题. 在使用eclipse创建maven web项目时,点Finish后报了Could not resolve archetype的问题. Could ...

  9. Java WEB开发环境搭建以及创建Maven Web项目

    根据此链接博文学习配置: http://www.cnblogs.com/zyw-205520/p/4767633.html 1.JDK的安装 自行百度,(最好是jdk1.7版本的) 测试如下图,即完成 ...

  10. IDEA创建Maven Web项目

    简单介绍 本篇博客主要介绍使用IDEA如何创建Maven Web项目,具体是两个方面的内容:创建项目和配置tomcat服务器.前提是根据IDEA入门配置好了JDK及Maven. 创建项目 新建项目 填 ...

随机推荐

  1. Spring3.2.9 + JdbcTemplate 事务

    XML新增声明式事务配置 <!-- 事务管理器 --> <bean id="transactionManager" class="org.springf ...

  2. 一些蠕虫传播研究的文章——TODO

    www.arocmag.com/getarticle/?aid=4e02d91c19b0cced Internet 蠕虫防范技术研究http://www.arocmag.com/article/100 ...

  3. mysql备份shell脚步

    #!/bin/bash  #Shell Command For Backup MySQL Database Everyday Automatically By Crontab     USER=roo ...

  4. 深入javascript之原型和原型链

    原型和原型链是js中的难点也是重点,明白了原型和原型链会让我们在后面不管是学习还是工作都会更加高效,并且原型和原型链会是面试中必不可少的话题.看完此篇文章一定会让你对原型,原型链有深刻全面的了解. 一 ...

  5. Codeforces Round #258 (Div. 2)C(暴力枚举)

    就枚举四种情况,哪种能行就是yes了.很简单,关键是写法,我写的又丑又长...看了zhanyl的写法顿时心生敬佩.写的干净利落,简直美如画...这是功力的体现! 以下是zhanyl的写法,转载在此以供 ...

  6. AMD 规范使用总结

    转自:http://www.jianshu.com/p/9b44a1fa8a96 AMD模式 define和require这两个定义模块.调用模块的方法,合称为AMD模式.它的模块定义的方法非常清晰, ...

  7. shell实现文件内容查询如输入姓名结果显示电话号码等信息

    #!/bin/awk -f BEGIN{FS=","; if(ARGC>2){name=ARGV[1];delete ARGV[1]} else{ echo "pl ...

  8. Java邮箱发送——企业版

    企业版邮箱发送工具类 import java.security.Security; import java.util.Properties; import javax.mail.Authenticat ...

  9. MongoDB数据库的备份和恢复

    MongoDB数据库备份方式: 1.整库备份 2.单表备份 1.整库备份 备份整个数据库: mongodump -h 127.0.0.1:27000 -d park --authenticationD ...

  10. 日志分隔工具Cronolog

    注:本文转载自 https://blog.csdn.net/weixin_38860565/article/details/81633234 Cronolog 分割 Tomcat8 Catalina. ...