在 MyEclipse 中开发 Maven 战争应用程序值得吗?
我的组织已做出上层决定,将 Maven 作为 Java 项目的标准构建工具。 我的任务是帮助我们的本地团队将项目迁移到 Maven。
MyEclipse IDE 是正在发挥作用的核心工具之一。 MyEclipse 似乎与 Maven 团队有着一段“有趣”的历史,如 证据 in 不同的地方,尤其是在处理战争项目时。 我还没有遇到过简单 jar 项目的问题。
在与 MyEclipse 进行斗争并未能使其轻松识别战争项目之后,问题就变成了,MyEclipse 是否值得用于开发 Maven 战争应用程序?
如果是这样,有没有办法让 MyEclipse 能够很好地处理我没有找到的战争项目? 或者,我只是建议现在将 Eclipse Java EE 版本与 m2eclipse 一起使用会更好吗?
My organization has made an upper level decision to move to maven as the standard build tool for Java projects. I have been tasked with helping our local teams migrate projects over to maven.
One of the core tools that is in play is the MyEclipse IDE. MyEclipse seems to have had a "fun" history with the maven team as evidenced in various places, especially when dealing with war projects. I haven't encountered problems with simple jar projects...yet.
After fighting with MyEclipse and failing to make it recognize a war project easily, the question becomes, is MyEclipse worth it for developing maven war apps?
If so, is there a way to get MyEclipse to play nicely with a war project that I've not found? Or, am I simply better off suggesting its time to use Eclipse Java EE edition with m2eclipse?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不可以。MyEclipse 不支持在其外部创建的项目。 根据设计,它仅适用于使用其向导创建的项目。
来自 在 MyEclipse 中使用 Maven 概述
No. MyEclipse does not support projects that were created outside of it. It is by design only working with projects created using its wizards.
From the Using Maven in MyEclipse Overview
我是一名技术主管,我们最近开始转向 Maven。 我在让 Maven 与 myeclipse 一起工作时遇到了一些问题。 首先,即使当我“启用所有 m2eclipse 功能”复选框时,我仍然无法从 subversion 将项目作为 Maven 项目签出。 该选项(您从 m2eclipse 获得)不可用。
此外,您通过 m2eclipse 获得的一些首选项在 maven4myeclipse 中不可用。
最后,我不能只卸载maven4eclipse插件并安装m2eclipse。 这本来是一个可以接受的解决方法。
我认为 Genutec 试图让 Maven 更容易被新手使用,但是在实现中存在一些问题,而且我认为它们不会很快得到修复。 对于我们来说,这可能会让 MyEclipse 成为一个精美的 jsp 编辑器。
I am working as a tech lead, and we recently started moving to maven. I had a couple of issues getting maven to work with myeclipse. First, even when I "Enabled all m2eclipse features" checkbox, I still couldn't check out a project as a maven project, from subversion. That option (that you get from m2eclipse) just wasn't available.
Also, some of the preferences you get with m2eclipse are not available with maven4myeclipse.
Finally, I couldn't just uninstall the maven4eclipse plugin and install m2eclipse. That would have been an acceptable workaround.
I think Genutec tried to make Maven more accesible to newbies, but there are some problems in the impementation, and I don't see them being fixed soon. For us, that will likely delegate MyEclipse to being just a fancy jsp editor.
Mike,
很抱歉听到您正在与 MyEclipse 和 Maven 作斗争,过去我见过在这方面给人们带来痛苦的最常见问题是他们没有正确设置 Web 根目录、Java 源目录或资源目录。
使用此网页作为标准 Maven2 Web 项目布局的参考,您可以轻松创建启用 Maven 的 MyEclipse Web 项目。 您要执行的步骤如下:“
开箱即用后,我们只隐藏那些可能会让第一次使用 Maven 的人感到困惑的部分,如果您启用所有 m2 位,您就可以使用 Maven 和 MyEclipse 做任何您想做的事情。 如果您仍然遇到问题,请访问我们的论坛并告知我们,我们将尽力提供帮助。
Mike,
Sorry to hear you are fighting MyEclipse and Maven, in the past the most common problem I've seen causing people pain in this area is when they don't have the Web Root, Java source dirs or resource dirs set correctly.
Using this webpage as reference for a standard Maven2 web project layout, you can easily create a Maven-enabled MyEclipse Web Project. The steps you would want to take are as follows:
Out of the box we only hide the bits that can make Maven confusing for first-time folks, if you enable all the m2 bits, you can do whatever you want with Maven and MyEclipse. If you keep having trouble stop by our forums and let us know and we'll help out as best we can.
麦克风,
我在寻找其他 Maven 资源时看到了这篇文章,所以我会插话。
为什么不使用 File > 导入现有项目呢? 导入并打开所有 m2eclipse 功能并像之前使用 maven 命令行工具一样继续开发吗? 我已经这样做了,一旦启用了 m2eclipse 功能(如 Riyad 的 #5 中所述),它就可以很好地用于遗留项目。
就我个人而言,我一直认为 Maven War 格式已经失败,但我们仍然有一些旧项目在使用它。 Maven 的格式只是一种默认格式(而且很差),而不是某种标准。 然而,我们目前将这些旧项目“按原样”保留(使用上述技术)只是因为它很简单。 但对于新工作,我们使用 MyEclipse Web 项目,然后只需在它们上启用 Maven 支持即可。 好处是您可以获得所有 Maven 支持,并且超级易于使用和管理,但不再需要命令行(尽管仍然有效),并且所有 MyEclipse 工具也可以在它们上完美运行。 这是一种“两全其美”的方法,至少对我们来说是这样。 YMMV。
希望有帮助,
戴夫
Mike,
I saw this post when looking for other Maven resources so I'll chime in.
Why not import your existing project using File > Import and turn on all the m2eclipse features and continue to develop it as you did before using maven commandline tools? I've done this and it works well for legacy projects, once m2eclipse features are enabled as mentioned in Riyad's #5.
Personally, I've always thought the maven war format was a bust, but we still have some old projects that use it around. Maven's format is just a default (and a poor one), not some sort of standard. However, we currently leave those old projects "as is" (using the above technique) just because it's easy. But for new work we use the MyEclipse web projects then just enable Maven support on them. The benefit is that you get all the Maven support and it's super easy to use and manage but no more commandline (although that still works too) and all the MyEclipse tools work perfectly on them as well. It's a "best of both" approach, well, at least for us. YMMV.
Hope that helps,
Dave
麦克风,
这里不是问题; 我在一家非常大的公司工作,该公司已经标准化了相当长的一段时间(幸运的是,我可能会补充一点,因为我们曾经是一家 WSAD 商店 - 不寒而栗。)
无论如何,如果您有一些使用 MyEclipse,而另一些则不使用我看到两个选择。 首先,如果您创建 MyEclipse Web 项目,然后向它们“添加 Maven 功能”(或任何名称),它们将在 MyEclipse 中以及 Maven 命令行中工作。 因此,即使您不使用 MyEclipse,您仍然可以使用命令行 Maven 工具。 另外,由于 MyEclipse 结构是更标准的“爆炸战争”布局,因此它也应该与您使用的其他任何东西一起工作。
另一件需要考虑的事情是,Maven 的 Web 布局只是默认的,Maven 可以轻松支持任何项目结构,包括 MyEclipse 使用的项目结构,因此您应该能够在任何工具中使用带有 Maven 的 MyEclipse 项目,只需一点额外的配置。 这可能就是为什么 Maven 命令行工具仍然可以在 MyEclipse Web 项目上工作的原因——MyEclipse 人员只是自动配置 Maven 来识别格式。
您也可以像我在上一篇文章中所说的那样导入外部创建的 Maven Web 项目。 我们不喜欢这样做,因为该结构是 Maven 独有的,并且不能与除 Maven 之外的任何工具一起使用。 因此,它基本上击败了您在 MyEclipse、Eclipse Java EE 或几乎任何其他工具中自动获得的工具支持。 这只是一个糟糕的默认值。 MyEclipse、Eclipse Java EE、WSAD、RAD 和其他所有人使用的 Exploded WAR 格式只是一个更好的解决方案。 特别是当它仍然可以与 Maven 一起正常工作时。
Maven 的设计使项目结构变得灵活。 我们刚刚发现,通过稍微使用这种灵活性,您也可以获得 Maven 支持和出色的工具支持。
戴夫
Mike,
Not an issue here; I work for a very large company that has been standardized on it for quite some time (happily, I might add as we used to be a WSAD shop -- shudder.)
Anyway, if you have some that use MyEclipse and some that don't I see two options. First, if you create MyEclipse web projects and then "Add Maven capabilities" (or whatever it's called) to them, they'll work in MyEclipse and from the Maven commandline as well. So even if you're not using MyEclipse you can still use the commandline Maven tools. Also, since the MyEclipse structure is the more standard "exploded war" layout, it should work with whatever else you use as well.
Other thing to consider is that Maven's web layout is simply a default and Maven can easily support any project structure, including the one MyEclipse uses, so you should be able to use the MyEclipse project with Maven in any tool with just a little additional config. That's likely why the Maven commandline tools still work on the MyEclipse Web projects -- the MyEclipse guys just automatically configure Maven to recognize the format.
You also could just import the externally created Maven web projects as I said in my last post. We don't like to do that because that structure is unique to Maven and just doesn't work with any tools except Maven. As a result, it basically defeats the the tool support you get automatically in MyEclipse, Eclipse Java EE, or pretty much any other tool. It's just a poor default. Exploded WAR format, that's used by MyEclipse, Eclipse Java EE, WSAD, RAD, and everyone else is simply a better solution. Especially when it still works with Maven just fine as well.
Maven was made to be flexible to project structure. We've just found by using that flexibility a little you can get Maven support and great tool support too.
Dave