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

图文讲解:

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

指定groupid、artifactid及version

创建完成窗口:

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

创建我们的项目目录:

java目录 设置成 Sources Root

resources目录 设置成Resources Root

test目录设置成Test Sources Root

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

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

配置tomcat  两种方式:

第一种:

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

    <build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/mavenDemo</path>
<port>8080</port>
</configuration>
</plugin>
</plugins>
</build>

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

除了这些 我们还需要引入自己所需要的项目依赖以及引入插件信息(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>com.alex</groupId>
<artifactId>mavenDemoProject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging> <name>mavenDemoProject 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> <!--引入项目依赖-->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!--jsp-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!--mysql,c3p0,dbutils-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- java编译插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!--&lt;!&ndash;配置maven中的tomcat&ndash;&gt;-->
<!--<plugin>-->
<!--<groupId>org.apache.tomcat.maven</groupId>-->
<!--<artifactId>tomcat7-maven-plugin</artifactId>-->
<!--<version>2.2</version>-->
<!--<configuration>-->
<!--<path>/mavenDemo</path>-->
<!--<port>8080</port>-->
<!--</configuration>-->
<!--</plugin>-->
</plugins>
</build>
</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. zoj 3965 Binary Tree Restoring(搜索)

    Binary Tree Restoring Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge Given two ...

  2. foobar2000下播放DSD音乐的插件

    需要测试foobar下面DSD的播放插件,翻遍了度娘,找不到一个容易下载的地方,要不一大堆广告,要不就是需要账号,烦死了,总是设置了很多障碍.其实这东西是人家老外开发的,最原始的插件名字叫做foo_i ...

  3. luogu 3375 KMP模板题

    #include<bits/stdc++.h> using namespace std; ,M = ; int next[N]; void getNext(char s[]) //找nex ...

  4. Windows vs Linux:\r\n 与 \r

    Linux 下文本文件的换行符为 \n Windows 下文本文件的换行符为 \r\n,占两个字节: \r:归位键(CR),ascii 码为 13 \n:换行键(LF),ascii 码位 10 也即单 ...

  5. 超简单tensorflow入门优化程序&&tensorboard可视化

    程序1 任务描述: x = 3.0, y = 100.0, 运算公式 x×W+b = y,求 W和b的最优解. 使用tensorflow编程实现: #-*- coding: utf-8 -*-) im ...

  6. eclipse Git & maven 安装

    JDK安装请自行百度. Maven是免安装的.压缩包解压完成后.如解压后放在D:\Server\maven下.接下来配置maven的环境变量: 系统变量:MAVEN_HOME = D:\Server\ ...

  7. C# XML反序列化与序列化举例:XmlSerializer

    using System; using System.IO; using System.Xml.Serialization; namespace XStream { /// <summary&g ...

  8. CAS单点登录系统简介

    一.cas简介 全名:Central Authentication Service特点: 1.开源的.多协议的 SSO 解决方案: Protocols : Custom Protocol . CAS ...

  9. 四、Jmeter--参数化

    一.CSV 参数化 1.我们做性能测试需要并发多个用户,为了真实模拟用户行为,我们需要模拟多个不同的用户登录,这是我们就需要进行参数化.这里我们选择比较常用的参数化方法-CSV Data Set Co ...

  10. 无法确定要使用哪一版本的 ASP.NET Web Pages。

    若要使用此站点,请在站点的 web.config 文件中指定一个版本.有关详细信息,请参阅 Microsoft 支持站点上的以下文章: http://go.microsoft.com/fwlink/? ...