如何使用Eclipse创建一个java项目的pom.xml? [英] How to create the pom.xml for a java project with Eclipse?

查看:522
本文介绍了如何使用Eclipse创建一个java项目的pom.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经有一个小的Java项目。我想将它移动到maven,所以我想使用Eclipse创建pom.xml,以便我可以使用命令提示符下的pom来构建它。我以前没有使用过maven,虽然我已经和蚂蚁合作了。



如何使用Eclipse为我的Java项目创建pom.xml?

解决方案

您应该使用新的可用的m2e插件来进行Eclipse中的Maven集成。在该插件的帮助下,您应该创建一个新的项目并将其移动到该项目中。这些是步骤:




  • 检查是否在您的eclipse发行版中安装了m2e(或前一个m2eclipse)。如果没有,请安装它。

  • 打开新建项目向导:文件>新>项目...

  • 打开 Maven 并选择 Maven Project 并点击 Next

  • 选择创建一个简单的项目 (跳过原型选择)。

  • 添加必要的信息:组ID,工件标识,包装== jar ,以及名称。

  • 完成向导。

  • 您的新Maven项目现已生成,您可以将源和测试包移动到工作区中的相关位置。

  • 之后您可以通过选择项目来构建项目(eclipse内),然后从上下文菜单中调用运行为> Maven安装


I already have a small Java project. I want to move it to maven, so I want to create the pom.xml using Eclipse so that I can build it using pom from command prompt. I have not worked with maven before, though I have worked with ant.

How can I create the pom.xml for my Java project using Eclipse?

解决方案

You should use the new available m2e plugin for Maven integration in Eclipse. With help of that plugin, you should create a new project and move your sources into that project. These are the steps:

  • Check if m2e (or the former m2eclipse) are installed in your eclipse distro. If not, install it.
  • Open the "New Project Wizard": File > New > Project...
  • Open Maven and select Maven Project and click Next.
  • Select Create a simple project (to skip the archetype selection).
  • Add the necessary information: Group Id, Artifact Id, Packaging == jar, and a Name.
  • Finish the Wizard.
  • Your new Maven project is now generated, and you are able to move your sources and test packages to the relevant location in your workspace.
  • After that, you can build your project (inside eclipse) by selecting your project, then calling from the context menu Run as > Maven install.

这篇关于如何使用Eclipse创建一个java项目的pom.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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