前面的文章我们已经在本机安装好了maven,同时在myeclipse中配置好了maven的插件。

链接如下:

Maven安装----在Windows上安装Maven

myeclipse安装maven插件

现在我们就开始在myeclipse中新建一个maven框架的web项目

新建项目

填写项目名称,一定记得勾选Add Maven support (java EE如果选取5.0报错,则选6.0)

我们的maven项目就新建好了,相关基本的依赖已经在pom.xml中.项目机构如下:

可能出现的错误及解决方案:

遇到的问题----新建maven项目ArtifactTransferException 和Execution default-testResources of goal

pom.xml的内容如下:

  1. <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">
  2. <modelVersion>4.0.0</modelVersion>
  3. <groupId>ipFilterM</groupId>
  4. <artifactId>ipFilterM</artifactId>
  5. <version>0.0.1-SNAPSHOT</version>
  6. <packaging>war</packaging>
  7. <name/>
  8. <description/>
  9. <properties>
  10. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  11. </properties>
  12. <dependencies>
  13. <dependency>
  14. <groupId>org.glassfish</groupId>
  15. <artifactId>bean-validator</artifactId>
  16. <version>3.0-JBoss-4.0.2</version>
  17. </dependency>
  18. <dependency>
  19. <groupId>org.glassfish</groupId>
  20. <artifactId>javax.annotation</artifactId>
  21. <version>3.0.1</version>
  22. </dependency>
  23. <dependency>
  24. <groupId>org.glassfish</groupId>
  25. <artifactId>javax.ejb</artifactId>
  26. <version>3.0.1</version>
  27. </dependency>
  28. <dependency>
  29. <groupId>org.glassfish</groupId>
  30. <artifactId>javax.enterprise.deploy</artifactId>
  31. <version>3.0.1</version>
  32. </dependency>
  33. <dependency>
  34. <groupId>org.glassfish</groupId>
  35. <artifactId>javax.jms</artifactId>
  36. <version>3.0.1</version>
  37. </dependency>
  38. <dependency>
  39. <groupId>org.glassfish</groupId>
  40. <artifactId>javax.management.j2ee</artifactId>
  41. <version>3.0.1</version>
  42. </dependency>
  43. <dependency>
  44. <groupId>org.eclipse.persistence</groupId>
  45. <artifactId>javax.persistence</artifactId>
  46. <version>2.0.0</version>
  47. </dependency>
  48. <dependency>
  49. <groupId>org.glassfish</groupId>
  50. <artifactId>javax.resource</artifactId>
  51. <version>3.0.1</version>
  52. </dependency>
  53. <dependency>
  54. <groupId>org.glassfish</groupId>
  55. <artifactId>javax.security.auth.message</artifactId>
  56. <version>3.0.1</version>
  57. </dependency>
  58. <dependency>
  59. <groupId>org.glassfish</groupId>
  60. <artifactId>javax.security.jacc</artifactId>
  61. <version>3.0.1</version>
  62. </dependency>
  63. <dependency>
  64. <groupId>org.glassfish</groupId>
  65. <artifactId>javax.servlet</artifactId>
  66. <version>3.0.1</version>
  67. </dependency>
  68. <dependency>
  69. <groupId>org.glassfish</groupId>
  70. <artifactId>javax.servlet.jsp</artifactId>
  71. <version>3.0.1</version>
  72. </dependency>
  73. <dependency>
  74. <groupId>org.glassfish</groupId>
  75. <artifactId>javax.servlet.jsp.jstl</artifactId>
  76. <version>3.0.1</version>
  77. </dependency>
  78. <dependency>
  79. <groupId>org.glassfish</groupId>
  80. <artifactId>javax.transaction</artifactId>
  81. <version>3.0.1</version>
  82. </dependency>
  83. <dependency>
  84. <groupId>javax.xml.bind</groupId>
  85. <artifactId>jaxb-api-osgi</artifactId>
  86. <version>2.2.1</version>
  87. </dependency>
  88. <dependency>
  89. <groupId>javax.ws.rs</groupId>
  90. <artifactId>jsr311-api</artifactId>
  91. <version>1.1.1</version>
  92. </dependency>
  93. <dependency>
  94. <groupId>org.glassfish.web</groupId>
  95. <artifactId>jstl-impl</artifactId>
  96. <version>1.2</version>
  97. </dependency>
  98. <dependency>
  99. <groupId>javax.mail</groupId>
  100. <artifactId>mail</artifactId>
  101. <version>1.4.3</version>
  102. </dependency>
  103. <dependency>
  104. <groupId>javax.xml</groupId>
  105. <artifactId>webservices-api-osgi</artifactId>
  106. <version>2.0.1</version>
  107. </dependency>
  108. <dependency>
  109. <groupId>org.jboss.weld</groupId>
  110. <artifactId>weld-osgi-bundle</artifactId>
  111. <version>1.0.1-SP3</version>
  112. </dependency>
  113. </dependencies>
  114. <build>
  115. <plugins>
  116. <plugin>
  117. <artifactId>maven-war-plugin</artifactId>
  118. </plugin>
  119. <plugin>
  120. <artifactId>maven-compiler-plugin</artifactId>
  121. <configuration>
  122. <source>1.6</source>
  123. <target>1.6</target>
  124. </configuration>
  125. </plugin>
  126. </plugins>
  127. </build>
  128. </project>

到这一步我们的web项目就建好了, 不过还有一步重要的步骤,就是把相关依赖的包下载到本地仓库。

对着项目右键: run as  ----> maven install

在控制台就可以看到 依赖包开始自动从 maven的中央仓库开始下载

下载完后我们可以看到build success

到此为止,我们的maven框架的web项目就新建好了。

MyEclipse使用总结——在MyEclipse中新建Maven框架的web项目[转]的更多相关文章

  1. Eclipse中发布Maven管理的Web项目时找不到类的问题根源和解决办法(转)

    转自:http://blog.csdn.net/lvguanming/article/details/37812579?locationNum=12 写在前面的话 现在是越来越太原讨厌Eclipse这 ...

  2. idea 中利用maven创建java web 项目

    转自:http://www.linuxidc.com/Linux/2014-04/99687.htm 本文主要使用图解介绍了使用IntelliJ IDEA 12创建Maven管理的Java Web项目 ...

  3. eclipse中基于maven构建的web项目pom.xml中指定的jar包无法发布到tomcat中

    eclipse运行maven web项目报错: 信息: Starting Servlet Engine: Apache Tomcat/7.0.57 一月 07, 2015 11:50:44 下午 or ...

  4. Maven入门1-在Eclipse中新建Maven Web项目

    在eclipse中新建Maven Web项目 很多时候开发效率低下,大部分原因是IDE环境不熟悉.配置不会配置:因此在学习一项技能之前,有必要对基本的环境配置有所了解,正所谓磨刀不误砍柴工.这篇文章主 ...

  5. eclipse中使用Maven新建Servlet2.5的Web项目

    前言 我们用Eclipse创建Maven结构的web项目的时候选择了Artifact Id为maven-artchetype-webapp,由于这个catalog比较老,用的servlet还是2.3的 ...

  6. Java web项目搭建系列之一 Eclipse中新建Maven项目

    前提条件: 已经安装好JDK 已经安装好Maven 已经安装好Eclipse 已经安装好Maven插件 在Eclipse中新建Maven项目 [File]→[New]→[Other...] [Mave ...

  7. 在IntelliJ IDEA中新建Maven项目

    在IntelliJ IDEA中新建Maven项目,选择“File->New->Project”,创建一个简单项目,不选择模板,如下图所示: 2 选择“Maven”,不需要使用内置结构(模板 ...

  8. Java归去来第4集:java实战之Eclipse中创建Maven类型的SSM项目

    一.前言 如果还不了解剧情,请返回第3集的剧情          Java归去来第3集:Eclipse中给动态模块升级 二.在Eclipse中创建Maven类型的SSM项目 2.1:SSM简介 SSM ...

  9. 在eclipse中,用maven创建一个web项目工程

    1.在eclipse中用maven创建项目,右键new>>Maven Project 2.点击next继续 3.点击next继续,选择maven-archetype-webapp, 4.点 ...

随机推荐

  1. 面试总结【css篇】- 盒子模型

    题目:谈谈你对CSS盒模型的认识 (1) 基本概念:标准模型+IE模型   (2) 标准模型和IE模型区别 标准模型和IE模型的区别,就是宽度和高度的计算方式不同. 标准模型的宽度指的就是conten ...

  2. python包下载路径

    python所有包.模块镜像站 https://www.lfd.uci.edu/~gohlke/pythonlibs/

  3. struts2类型转换2

    如何自定义类型转换器 ? 1). 为什么需要自定义的类型转换器 ? 因为 Struts 不能自动完成 字符串 到 引用类型 的 转换. 2). 如何定义类型转换器: I. 开发类型转换器的类: 扩展 ...

  4. RAksmart服务器具备哪些特点?

    美国RAKsmart机房运营多年,前身是提供美国军用服务器业务,拥有着庞大的用户群体和消费者,那RAksmart服务器具备哪些特点呢? 1.美国raksmart服务器特点——硬盘超大 美国raksma ...

  5. python 使用字符串

    字符串方法 string.digits:包含数字0-9的字符串 string.letters:包含所有字母(大写或小写)的字符串 string.lowercase:包含所有小写字母的字符串 strin ...

  6. OSS支持IPV6/IPV4双栈访问域名

    摘要: OSS开放IPv6/IPv4双栈域名,可同时支持IPv6/IPv4客户端的访问,支持下一代互联网技术IPv6,可服务海量物理网设备连接等应用场景. 下一代IP协议 IPv4地址已接近枯竭,被誉 ...

  7. thinkphp一键清除缓存的方法

    后台控制器: <?php namespace Home\Controller; use Think\Controller; class HuancuController extends Cont ...

  8. Http学习(二)

    使用首部字段是为了给浏览器和服务器提供报文主体大小.所使用语言.认证信息等 4种首部字段类型 通用首部字段 请求首部字段 响应首部字段 实体首部字段 详细说明: HTTP首部字段类型 通用首部字段: ...

  9. 关于Delphi中的字符串的详细分析

    关于Delphi中的字符串的详细分析   只是浅浅的解析下,让大家可以快速的理解字符串. 其中的所有代码均在Delphi7下测试通过. Delphi 4,5,6,7中有字符串类型包括了: 短字符串(S ...

  10. 为什么程序员都不喜欢使用switch,而是大量的 if……else if ?

    作者:熊爸爸 原文:http://3g.163.com/tech/article/E02RDE6C0511SDDL.html 请用5秒钟的时间查看下面的代码是否存在bug. OK,熟练的程序猿应该已经 ...