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

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

问题描述

对于工作中的项目,我们正在考虑使用 Eclipse 的 Maven 插件来自动化我们的构建.现在这个过程比它应该的复杂得多,我们希望 Maven 将事情简化为一键构建.

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.

我的问题是,是否有使用 Maven 插件将现有 Eclipse Java 项目转换为 Maven 项目的向导或自动导入器?或者我应该创建一个新的 Maven 项目并手动复制所有源文件、库等.

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.

推荐答案

如果您只想创建默认 POM 并启用 m2eclipse 功能:所以我假设您目前没有正在尝试的替代自动构建设置导入,我假设您在谈论 m2eclipse 插件.

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.

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

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

较新的 M2E 版本

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

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

较旧的 M2E 版本

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

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

这将完成为该项目启用插件所需的工作.

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


回答是否有自动导入程序或向导?":我不知道.使用上面的选项将允许您为现有项目启用 m2eclipse 插件,避免手动复制.您仍然需要实际设置依赖项以及您自己构建所需的其他内容.

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天全站免登陆