将现有Eclipse项目转换为Maven项目 [英] Convert Existing Eclipse Project to Maven Project

查看:121
本文介绍了将现有Eclipse项目转换为Maven项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于工作中的项目,我们正在考虑使用Eclipse的Maven插件来自动化我们的构建。现在这个程序比它应该要复杂得多,我们希望Maven能够简化一个单击构建的工作。我的问题是,有没有一个向导或自动导入器,用于将现有的Eclipse Java项目转换为Maven项目,使用Maven插件?
或者我应该创建一个新的Maven项目,并手动复制所有源文件,libs等。

解决方案

如果您只需要创建一个默认的POM并启用m2eclipse功能:所以我假设你目前没有一个替代的自动构建设置,你正在尝试导入,我假设你正在谈论的m2eclipse插件。 / p>

m2eclipse插件在项目中提供了一个右键单击选项来添加此默认pom.xml:



较新的M2E版本



右键单击项目 - >子菜单配置 - >转换为Maven项目



较旧的M2E版本



右键单击项目 - >子菜单Maven - >启用依赖关系管理。



这将需要启用该项目的插件。






要回答是否有自动进口商或向导?:不是我知道的。使用上述选项将允许您为现有项目启用m2eclipse插件,避免手动复制。您仍然需要实际设置您需要建立的依赖关系和其他内容。


For a project at work, we're considering using the Maven plugin for Eclipse to automate our builds. Right now the procedure is far more complicated than it ought to be, and we're hoping that Maven will simplify things to a one-click build.

My question is, is there a wizard or automatic importer for converting an existing Eclipse Java project to a Maven project, using the Maven plugin? Or should I create a new Maven project and manually copy over all source files, libs, etc.

解决方案

If you just want to create a default POM and enable m2eclipse features: so I'm assuming you do not currently have an alternative automated build setup you're trying to import, and I'm assuming you're talking about the m2eclipse plugin.

The m2eclipse plugin provides a right-click option on a project to add this default pom.xml:

Newer M2E versions

Right click on Project -> submenu Configure -> Convert to Maven Project

Older M2E versions

Right click on Project -> submenu Maven -> Enable Dependency Management.

That'll do the necessary to enable the plugin for that project.


To answer 'is there an automatic importer or wizard?': not that I know of. Using the option above will allow you to enable the m2eclipse plugin for your existing project avoiding the manual copying. You will still need to actually set up the dependencies and other stuff you need to build yourself.

这篇关于将现有Eclipse项目转换为Maven项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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