eclipse Eclipse中的Maven:分步安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8620127/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:47:32  来源:igfitidea点击:

Maven in Eclipse: step by step installation

eclipsemaveneclipse-plugin

提问by IAmYourFaja

I have spent been on the Maven site reading the 5- and 30-minute tutorials, and trialing Maven out for the first time.

我一直在 Maven 站点上阅读 5 分钟和 30 分钟的教程,并第一次试用 Maven。

I want to install a Maven plugin and use it to start building Maven projects from Eclipse.

我想安装一个 Maven 插件并使用它从 Eclipse 开始构建 Maven 项目。

Despite an honest effort, I have been unable to find a comprehensive tutorial on any Maven plugin. M2E, which seems like the de facto standard, has nothing but broken (or recursive) links on their site.

尽管付出了真诚的努力,但我一直无法找到有关任何 Maven 插件的综合教程。M2E,这似乎是事实上的标准,在他们的网站上只有断开的(或递归的)链接。

I can't tell if I even installed the plugin correctly, or how to use it.

我不知道我是否正确安装了插件,或者如何使用它。

Does anyone know of a good step-by-step guide to M2Eor any other plugin? One that comes with good installation documentation, along with a solid explanation of its features and proper uses?

有谁知道一个很好的分步指南M2E或任何其他插件?一个带有良好的安装文档,以及对其功能和正确使用的可靠解释的?

回答by Ripon Al Wasim

(Edit 2016-10-12: Many Eclipse downloads from https://eclipse.org/downloads/eclipse-packages/have M2Eclipse included already. As of Neon both the Java and the Java EE packages do - look for "Maven support")

(编辑 2016-10-12:从https://eclipse.org/downloads/eclipse-packages/下载的许多 Eclipse已经包含 M2Eclipse。从 Neon 开始,Java 和 Java EE 包都可以 - 寻找“Maven 支持” )

Way 1:Maven Eclipse plugin installation step by step:

方式一:Maven Eclipse插件安装步骤:

  1. Open Eclipse IDE
  2. Click Help -> Install New Software...
  3. Click Add button at top right corner
  4. At pop up: fill up Name as "M2Eclipse" and Location as "http://download.eclipse.org/technology/m2e/releases" or http://download.eclipse.org/technology/m2e/milestones/1.0

  5. Now click OK

  1. 打开 Eclipse IDE
  2. 单击帮助 -> 安装新软件...
  3. 点击右上角的添加按钮
  4. 在弹出窗口:填写名称为“M2Eclipse”和位置为“ http://download.eclipse.org/technology/m2e/releases”或 http://download.eclipse.org/technology/m2e/milestones/1.0

  5. 现在点击确定

After that installation would be started.

之后,安装将开始。

Way 2:Another way to install Maven plug-in for Eclipse by "Eclipse Marketplace":

方式二:另一种通过“Eclipse Marketplace”为Eclipse安装Maven插件的方式:

  1. Open Eclipse
  2. Go to Help -> Eclipse Marketplace
  3. Search by Maven
  4. Click "Install" button at "Maven Integration for Eclipse" section
  5. Follow the instruction step by step
  1. 打开日食
  2. 转到帮助 -> Eclipse Marketplace
  3. 按 Maven 搜索
  4. 单击“Eclipse Maven 集成”部分的“安装”按钮
  5. 按照说明一步一步来

After successful installation do the followings in Eclipse:

安装成功后,在 Eclipse 中执行以下操作:

  1. Go to Window --> Preferences
  2. Observe, Maven is enlisted at left panel
  1. 转到窗口 --> 首选项
  2. 观察,Maven 在左侧面板上登记

Finally,

最后,

  1. Click on an existing project
  2. Select Configure -> Convert to Maven Project
  1. 单击现有项目
  2. 选择配置 -> 转换为 Maven 项目

回答by Mukesh Kumar

IF you want to install Maven in Eclipse(Java EE) Indigo Then follow these Steps :

如果您想在 Eclipse(Java EE) Indigo 中安装 Maven,请按照以下步骤操作:

  1. Eclipse -> Help -> Install New Software.

  2. Type " http://download.eclipse.org/releases/indigo/" & Hit Enter.

  3. Expand " Collaboration " tag.

  4. Select Maven plugin from there.

  5. Click on next .

  6. Accept the agreement & click finish.

  1. Eclipse -> 帮助 -> 安装新软件。

  2. 输入“ http://download.eclipse.org/releases/indigo/”并按回车键。

  3. 展开“协作”标签。

  4. 从那里选择 Maven 插件。

  5. 点击下一步。

  6. 接受协议并单击完成。

After installing the maven it will ask for restarting the Eclipse,So restart the eclipse again to see the changes.

安装maven后会要求重启Eclipse,所以再次重启eclipse看看变化。

回答by Sri Sankaran

By "use install a Maven plugin and use it" I am sure you are looking for a Eclipseplugin that will perform Maven functions within the IDE. If so, M2E is a good choice. You will find a lot of help within the Eclipse installation once you install M2E.

通过“使用安装 Maven 插件并使用它”,我相信您正在寻找一个Eclipse插件,它可以在 IDE 中执行 Maven 功能。如果是这样,M2E 是一个不错的选择。安装 M2E 后,您会在 Eclipse 安装中找到很多帮助。

That said -- considering that you are starting off using Maven -- it would go a long way to have a good understanding of the basic concepts. Using M2E could hidesome of the details which could lead to incomplete or incorrect interpretation of Maven's behavior and therefore problems downstream.

也就是说 - 考虑到您开始使用 Maven - 对基本概念有很好的理解会有很长的路要走。使用 M2E 可能会隐藏一些细节,这些细节可能导致对 Maven 行为的不完整或不正确的解释,从而导致下游问题。

Some good Maven online references are:

一些不错的 Maven 在线参考资料是:

回答by Anil Satija

First install maven in your system and set Maven environment variables

首先在你的系统中安装 maven 并设置 Maven 环境变量

  1. M2_HOME: ....\apache-maven-3.0.5 \ maven installed path
  2. M2_Repo: D:\maven_repo \If change maven repo location
  3. M2: %M2_HOME%\bin
  1. M2_HOME: ....\apache-maven-3.0.5\maven 安装路径
  2. M2_Repo: D:\maven_repo \If change maven repo location
  3. M2:%M2_HOME%\bin

Steps to Configures maven on Eclipse IDE:

在 Eclipse IDE 上配置 maven 的步骤:

  • Select Window -> Preferences Note: If Maven option is not present, then add maven 3 to eclipse or install it.
  • Add the Maven location of your system
  • 选择Window -> Preferences 注意:如果Maven 选项不存在,则将maven 3 添加到eclipse 或安装它。
  • 添加系统的 Maven 位置

To check maven is configured properly:

要检查 maven 是否配置正确:

  • Open Eclipse and click on Windows -> Preferences

  • Choose Maven from left panel, and select installations.

  • Click on Maven -> "User Settings" option form left panel, to check local repository location.

  • 打开 Eclipse 并单击 Windows -> Preferences

  • 从左侧面板中选择 Maven,然后选择安装。

  • 单击左侧面板中的 Maven ->“用户设置”选项,以检查本地存储库位置。

回答by Hojat Modaresi

Check This

检查这个

instead to avoid this error:

而是为了避免此错误:

Cannot complete the install because one or more required items could not be found. Software being installed: m2e - slf4j over logback logging (Optional) 1.6.1.20150625-2338 (org.eclipse.m2e.logback.feature.feature.group 1.6.1.20150625-2338) Missing requirement: Maven Integration for Eclipse 1.6.0.20150526-2032 (org.eclipse.m2e.core 1.6.0.20150526-2032) requires 'bundle com.google.guava [14.0.1,16.0.0)' but it could not be found Missing requirement: Maven Integration for Eclipse 1.6.1.20150625-2338 (org.eclipse.m2e.core 1.6.1.20150625-2338) requires 'bundle org.eclipse.osgi 3.10.0' but it could not be found Cannot satisfy dependency: From: Maven Integration for Eclipse 1.6.0.20150526-2032 (org.eclipse.m2e.core.ui 1.6.0.20150526-2032) To: bundle org.eclipse.m2e.core [1.6.0,1.7.0) Cannot satisfy dependency: From: Maven Integration for Eclipse 1.6.1.20150625-2338 (org.eclipse.m2e.core.ui 1.6.1.20150625-2338) To: bundle org.eclipse.m2e.core [1.6.0,1.7.0) Cannot satisfy dependency: From: m2e logback appender 1.6.1.20150625-2338 (org.eclipse.m2e.logback.appender 1.6.1.20150625-2338) To: bundle org.eclipse.m2e.core.ui [1.6.0,1.7.0) Cannot satisfy dependency: From: m2e - slf4j over logback logging (Optional) 1.6.1.20150625-2338 (org.eclipse.m2e.logback.feature.feature.group 1.6.1.20150625-2338) To: org.eclipse.m2e.logback.appender [1.6.1.20150625-2338]

无法完成安装,因为找不到一个或多个必需的项目。正在安装的软件:m2e - slf4j over logback logging(可选)1.6.1.20150625-2338 (org.eclipse.m2e.logback.feature.feature.group 1.6.1.20150625-2338) 缺少要求:Eclipse 1.6.02020 的 Maven 集成。 (org.eclipse.m2e.core 1.6.0.20150526-2032) 需要 'bundle com.google.guava [14.0.1,16.0.0)' 但找不到缺少的要求:Maven Integration for Eclipse 1.6.1.20150625-2338 (org.eclipse.m2e.core 1.6.1.20150625-2338) 需要 'bundle org.eclipse.osgi 3.10.0' 但找不到它不能满足依赖:来自:Eclipse 1.6.0.20150526-2032 (org. eclipse.m2e.core.ui 1.6.0.20150526-2032) 至:bundle org.eclipse.m2e.core [1.6.0,1.7.

source

来源

回答by sunitha

You have to follow the following steps in the Eclipse IDE

您必须在 Eclipse IDE 中执行以下步骤

  1. Go to Help - > Install New Software
  2. Click add button at top right corner
  3. In the popup coming, type in name as "Maven" and location as "http://download.eclipse.org/technology/m2e/releases"
  4. Click on OK.
  1. 转到帮助 - > 安装新软件
  2. 点击右上角的添加按钮
  3. 在弹出的窗口中,输入名称为“Maven”,位置为“ http://download.eclipse.org/technology/m2e/releases
  4. 单击确定。

Maven integration for eclipse will be dowloaded and installed. Restart the workspace.

将下载并安装 Eclipse 的 Maven 集成。重新启动工作区。

In the .m2 folder(usually under C:\user\ directory) add settings.xml. Give proper proxy and profiles. Now create a new Maven project in eclipse.

在 .m2 文件夹中(通常在 C:\user\ 目录下)添加 settings.xml。提供适当的代理和配置文件。现在在 Eclipse 中创建一个新的 Maven 项目。

回答by amoljdv06

Maven Eclipse plugin installation step by step:

Maven Eclipse插件安装步骤:

Open Eclipse IDE Click Help -> Install New Software Click Add button at top right corner At pop up: fill up Name as you want and Location as http://download.eclipse.org/technology/m2e/milestones/1.0Now click OK And follow the instruction

打开 Eclipse IDE 点击 Help -> Install New Software 点击右上角的 Add 按钮弹出:填写 Name as you want 和 Location as http://download.eclipse.org/technology/m2e/milestones/1.0现在点击 OK并按照说明

回答by user3749024

I have also come across the same issue and figuredout the issue here is the solution.

我也遇到了同样的问题,并发现这里的问题是解决方案。

Lot of people assumes Eclipse and maven intergration is tough but its very eassy.

很多人认为 Eclipse 和 maven 的集成很难,但很容易。

1) download the maven and unzip it in to your favorite directory.

1) 下载 maven 并将其解压缩到您喜欢的目录中。

Ex : C:\satyam\DEV_TOOLS\apache-maven-3.1.1

例如:C:\satyam\DEV_TOOLS\apache-maven-3.1.1

2) Set the environment variable for Maven(Hope every one knows where to go to set this)

2) 设置Maven的环境变量(希望大家知道去哪里设置)

In the system variable: Variable_name = M2_HOME Variable_Value =C:\satyam\DEV_TOOLS\apache-maven-3.1.1

在系统变量中:Variable_name = M2_HOME Variable_Value =C:\satyam\DEV_TOOLS\apache-maven-3.1.1

Next in the same System Variable you will find the variable name called Path: just edit the path variable and add M2_HOME details like with the existing values.

接下来在同一个系统变量中,您将找到名为 Path 的变量名称:只需编辑路径变量并添加 M2_HOME 详细信息,就像使用现有值一样。

%M2_HOME%/bin;

so in the second step now you are done setting the Maven stuff to your system.you need to cross check it whether your setting is correct or not, go to command prompt and type mvn--version it should disply the path of your Maven

因此,在第二步中,您已完成将 Maven 内容设置到您的系统。您需要交叉检查您的设置是否正确,转到命令提示符并键入 mvn--version 它应该显示您的 Maven 的路径

3) Open the eclipse and go to Install new software and type M2E Plugin install and restart the Eclipse

3) 打开 eclipse 并转到 Install new software 并键入 M2E Plugin install 并重新启动 Eclipse

with the above 3 steps you are done with Maven and Maven Plugin with eclipse

通过以上 3 个步骤,您就完成了 Maven 和 Maven Plugin with eclipse

4) Maven is used .m2 folder to download all the jars, it will find in Ex: C:\Users\tempsakat.m2

4) Maven 使用 .m2 文件夹下载所有 jars,它会在 Ex: C:\Users\tempsakat.m2 中找到

under this folder one settings.xml file and one repository folder will be there

在此文件夹下将有一个 settings.xml 文件和一个存储库文件夹

5) go to Windwo - preferences of your Eclipse and type Maven then select UserSettings from left menu then give the path of the settings.xml here .

5) 转到 Windwo - Eclipse 的首选项并键入 Maven,然后从左侧菜单中选择 UserSettings,然后在此处提供 settings.xml 的路径。

now you are done...

现在你完成了...

回答by user1452911

Tried every stuff but this one worked .. 1. Eclipse -> Help -> Install New Software. 2. Type " http://download.eclipse.org/releases/indigo/" & Hit Enter. 3. Expand " Collaboration " tag. 4. Select Maven plugin from there. 5. Click on next . 6. Accept the agreement & click finish. After installing the maven it will ask for restarting the Eclipse, So restart the eclipse again to see the changes.

尝试了所有东西,但这个有效.. 1. Eclipse -> 帮助 -> 安装新软件。2.输入“ http://download.eclipse.org/releases/indigo/”并回车。3. 展开“协作”标签。4. 从那里选择 Maven 插件。5. 点击下一步。6. 接受协议并点击完成。安装maven后会要求重启Eclipse,所以再次重启eclipse看看变化。

Thanks Mukesh for Guiding.

感谢穆克什的指导。

回答by Jenis Kasundra

I have just include Mavenintegration plug-in with Eclipse:

我刚刚包含了Maven集成插件Eclipse

Just follow the bellow steps:

只需按照以下步骤操作:

In eclipse, from upper menu item select- Help->click on Install New Software..-> then click on Addbutton.

在 中eclipse,从上层菜单项中选择Help-->点击Install New Software..->然后点击Add按钮。

set the MavenAPIat name text box and http://download.eclipse.org/technology/m2e/releasesat location text box.

设置MavenAPIat name 文本框和http://download.eclipse.org/technology/m2e/releasesat location 文本框。

press OKand select the Mavenproject and install by clicking next.

OK并选择Maven项目并单击 安装next