简体   繁体   English

我可以使用命令行将 Eclipse 项目转换为 Maven 吗?

[英]Can I convert Eclipse Project to maven using command line?

The issue I have is that I have to work in an Eclipse version that doesn't allow any additional Plugins and hence, installing maven is not an option.我遇到的问题是我必须在不允许任何额外插件的 Eclipse 版本中工作,因此,安装 maven 不是一种选择。

However, I am wondering whether I can still use command line to create my maven project.但是,我想知道我是否仍然可以使用命令行来创建我的 Maven 项目。

If I create a maven project from command line, Eclipse -> File -> Import didn't work.如果我从命令行创建一个 Maven 项目,Eclipse -> File -> Import 不起作用。 I tried to create my maven project inside eclipse project folders and I got a maven folder structure inside my original eclipse project.我尝试在 eclipse 项目文件夹中创建我的 maven 项目,并且在我的原始 eclipse 项目中得到了一个 maven 文件夹结构。 Using the eclipse IDE I renamed the src folder and instead called the Maven created structure 'src'.使用 Eclipse IDE,我重命名了 src 文件夹,而是将 Maven 创建的结构称为“src”。 That created a mess because I cannot create packages instead these folders.这造成了混乱,因为我无法创建包而不是这些文件夹。

Best Regards,此致,

The M2e plugin Eclipse is strongly recommended to work on a Maven project in Eclipse.强烈建议使用 M2e 插件 Eclipse在 Eclipse 中处理 Maven 项目。
If you have network constraints to install it from classic Eclipse plugin installation, you may still install it by building the source code of the plugin .如果您有网络限制从经典 Eclipse 插件安装中安装它,您仍然可以通过构建插件的源代码来安装它。

As an alternative, you could use the Apache Maven Eclipse Plugin that relies on Maven only and not Eclipse.作为替代方案,您可以使用仅依赖于 Maven 而不是 Eclipse 的Apache Maven Eclipse 插件 Using it allows to generate Eclipse classpath according to the pom dependencies.使用它允许根据 pom 依赖项生成 Eclipse 类路径。
Particularly : mvn eclipse:eclipse that generates the Eclipse configuration files.特别是: mvn eclipse:eclipse生成 Eclipse 配置文件。

The Maven Eclipse Plugin is used to generate Eclipse IDE files (*.classpath, *.project, *.wtpmodules and the .settings folder) for use with a project. Maven Eclipse 插件用于生成用于项目的 Eclipse IDE 文件(*.classpath、*.project、*.wtpmodules 和 .settings 文件夹)。

But it is deprecated and is not maintained any longer.但它已被弃用,不再维护。 So I cannot recommend it.所以我不能推荐它。

Disclaimer: Users are advised to use m2e, the Eclipse Maven Integration instead of this plugin, as it can more closely resemble the actual build and runtime classpaths as described in the project pom.xml - among other advantages.免责声明:建议用户使用 m2e,Eclipse Maven 集成而不是这个插件,因为它可以更接近项目 pom.xml 中描述的实际构建和运行时类路径 - 以及其他优点。 However, there are project setups and workflows that still work more efficiently with statically generated Eclipse metadata - for example when there is a large number of projects in a reactor.但是,使用静态生成的 Eclipse 元数据仍然可以更有效地使用项目设置和工作流 - 例如,当反应器中有大量项目时。 That's where the Maven Eclipse Plugin can still help you.这就是 Maven Eclipse 插件仍然可以帮助您的地方。

Which version of Eclipse you are using ?您使用的是哪个版本的 Eclipse? You can apply plugin.您可以应用插件。 Also, make sure your proxy should not block the eclipse to download the plugins.另外,请确保您的代理不应该阻止 eclipse 下载插件。 For proxy settings, refer setting.xml in conf folder of maven.代理设置请参考maven conf文件夹下的setting.xml。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven项目可以在Eclipse中运行,但不能从命令行运行 - Maven project works in eclipse but not from command line Maven项目在命令行中运行,但不在Eclipse中运行 - Maven project runs in command line but not in Eclipse 我可以从 Eclipse 使用 Maven,但不能从命令行使用 - I can use Maven from Eclipse, but not from command line DTD在Eclipse中的项目目标路径中显示,但在通过Maven命令行使用时不显示 - DTDs show up in project target path in Eclipse but not when using via Maven command line Maven项目从eclipse正确运行但不是命令行 - Maven project running correctly from eclipse but not command line Maven从Eclipse而不是命令行中看到依赖的项目jar - Maven sees dependent project jar from Eclipse but not from the command line 我可以从命令行运行Eclipse项目,但无法通过Eclipse运行它 - I can run an Eclipse project from command line but I cannot run it via Eclipse 在maven项目中使用非maven jar(使用命令行) - Use non-maven jar in maven project (using command line) 我可以在命令行中添加 maven 存储库吗? - Can I add maven repositories in the command line? eclipse-maven项目-NoClassDefFoundError从eclipse运行,但从命令行运行良好 - eclipse-maven project - NoClassDefFoundError running from eclipse but runs fine from command line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM