使用 Maven 和 Eclipse Helios 创建完整的 EAR 项目 [英] Create complete EAR Project with Maven and Eclipse Helios

查看:49
本文介绍了使用 Maven 和 Eclipse Helios 创建完整的 EAR 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了一些关于如何设置 eclipse 和 maven 以创建新的空耳项目的文章,但所有解决方案都不完整或过时.

I read some articles about how to set up eclipse and maven to create a new empty ear project but all solutions weren't complete or are to old.

我相信我需要创建三个 pom.xml 文件/或三个项目:

I believe that I need to create three pom.xml files / or three projects:

  1. 具有 WEB-APP 结构的客户端项目(类似于常规的动态 Web 项目).这应该会生成一个 WAR 文件.
  2. 带有 ejbs 的服务器项目.这应该是一个 JAR 文件.
  3. ear 项目将两个项目结合在一起.

我在 eclipse 中集成的 maven 插件的帮助下尝试了这一点.因为(我相信 Helios)maven 已经集成在 eclipse 中.所以我去

I tried that with help of the integrated maven plugin in eclipse. Since (I believe Helios) maven is already integrated in eclipse. So I go to

file -> new -> maven -> maven project

file -> new -> maven -> maven project

并取消选中创建简单项目"复选框.在另一边,我得到了原型目录.为了创建客户端项目,我寻找了 maven-archetype-webapp 版本 1.0.但是所有像 WebContentMETA-INF 等的文件夹都不见了.

and leave the "create a simple project" checkbox unchecked. On the next side I got the archetype catalog. To create the client project I looked for maven-archetype-webapp Version 1.0. But all the folders like WebContentMETA-INF etc. are missing.

那么如何创建所有三个项目并将它们构建在一起?

So how can I create all three projects are build them together?

非常感谢,豪克

PS.:我在问题 5668710 中阅读了有关在没有 maven 的情况下创建项目并激活依赖项管理的内容.但这是正确的方法吗?我不这么认为.

PS.: I read in question 5668710 about creating the project without maven and activate the dependency management. But is that the right way? I don't think so.

推荐答案

通过 console 创建项目并通过 m2eclipse 导入它们将是最好的方法,因为你可以在您的问题的评论中阅读它.

Creating the projects via console and importing them via m2eclipse would be the best way, as you can read it in the comments of your question.

从控制台中的这一行开始

Start off with this line in your console

mvn archetype:generate

然后使用原型maven-archetype-j2ee-simple

这将为您生成ejbearweb 项目的项目结构.否则你可以自己创建 3 个简单的项目 maven-archetype-quickstart 并添加相关插件

This will generate you a project structure for ejb, ear and web projects. Otherwise you can create 3 simple projects maven-archetype-quickstart on your own and add the concering plugins

这是另一篇文章,处理您的问题:Maven2:最佳实践用于企业项目(EAR 文件)

Here is another post, handling your problem: Maven2: Best practice for Enterprise Project (EAR file)

另一个很好的例子,你可以找到 这里

Another nice example you can find here

这篇关于使用 Maven 和 Eclipse Helios 创建完整的 EAR 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆