如何在没有 M2Eclipse 的情况下从 Eclipse 执行 Maven 目标?

发布于 2024-11-18 21:25:17 字数 902 浏览 2 评论 0原文

我正在使用 maven 的 eclipse 插件从 maven pom.xml 文件生成 eclipse 项目。

mvn -Dwtpversion=1.5 eclipse:eclipse

这工作得很好,在对 400 种不同的可用原型进行了一些实验之后,我决定使用 webapp-javaee6 原型,它是唯一生成一组都可用的依赖项的原型并创建了一个可供 WTP 插件使用的项目。

现在的问题是我希望能够从 eclipse 调用 mvn 目标。据我所知,接受的方法是使用我已经安装的 m2eclipse 插件。

然而,经过一番尝试却一无所获后,我在我的 .project 文件中发现了这条评论:

<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>

进一步搜索(请参阅这篇来自 10 月份的长篇谩骂)表明我并不(只是)愚蠢地无法让它发挥作用。

这个问题的最佳答案中链接的操作方法似乎已经过时了。

那么,真正的问题——目前使用maven生成一个WTP友好的项目,可以转换为eclipse,然后使用eclipse调用项目的目标,正确的方法是什么?

I am using the eclipse plugin for maven to generate eclipse projects from maven pom.xml files.

mvn -Dwtpversion=1.5 eclipse:eclipse

This works fine and, after some experimenting with several of the 400 different archetypes available, I settled on using the webapp-javaee6 archetype, which was the only one which generated a set of dependencies that were both all available and which created a project that was useable by the WTP plugin.

The problem now is that I would like to be able to invoke mvn goals from eclipse. The accepted way to do this I understand is to use the m2eclipse plugin, which I have installed.

However, after playing around a bit and getting nowhere I discovered this comment in my .project file:

<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>

Further searching (see this lengthy diatribe from October) suggests I'm not (just) being stupid in not being able to get this to work.

The how-to linked in the top answer to this question seems hopelessly out of date.

So, the real question - what is currently the correct way to use maven to generate a WTP-friendly project that can be converted to eclipse and then use eclipse to call the project's goals?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧梦荧光笔 2024-11-25 21:25:17

您是否尝试过“文件”->“导入->查看 SCM 中现有的 Maven 项目?我的理解是 m2eclipse 将为您创建 eclipse 项目。如果 pom 中定义的打包是 war,则该项目应该可以使用 WTP 进行部署。 (后者曾经也需要 maven-wtp-integration 插件,不知道现在是否仍然如此)。

Have you tried File -> Import -> Check out existing Maven Projects from SCM? My understanding is that m2eclipse will then create the eclipse project for you. If the packaging defined in the pom is war, the project should be deployable with WTP. (The latter used to require an the maven-wtp-integration plugin as well, don't know whether that's still the case).

甜警司 2024-11-25 21:25:17

不确定 WTP 或 maven 原型,但是您是否遇到过 SpringSource Tool Suite(Spring 打包的 eclipse)并创建了 Spring Roo 项目?您可以使用它在几分钟内创建一个数据驱动的 Maven 构建的 Web 应用程序。如果您不需要的话,您甚至可以删除 spring roo 位,这将为您提供一个网络应用程序的良好起点,而且几乎没有什么痛苦。

Not sure about WTP or maven archetypes, but have you come across SpringSource Tool Suite (Spring packaged eclipse) and created a Spring Roo project? You can use this to create a data driven maven built web-app in a few mins. You can even remove the spring roo bits if you don't want them, it will give you a good starting point for a web-app with very little pain.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文