如何配置Eclipse EE以使用外部Maven(Windows 7) [英] How to configure eclipse EE to use the external maven (Windows 7)

查看:162
本文介绍了如何配置Eclipse EE以使用外部Maven(Windows 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Maven的新手.当我运行此命令时,我得到拒绝访问错误?有什么帮助吗?我正在尝试配置Maven以使其与Eclipse一起运行.让我知道您是否需要更多信息.

New to maven. When I run this command i get access denied error? any help? I am trying to configure maven to run with eclipse. Let me know if you need more information.

mvn -Declipse.workspace=<c:\temp\eclipse\workspace>eclipse:add-mvn-repo

Path:
C:\apache-tomcat-7.0.55\bin;C:\apache-ant-1.9.4-bi
n\bin;C:\apache-maven-3.2.2\bin;C:\Program Files (x86)\Google\google_appengine\

C:\Temp\eclipse\workspace>mvn -v
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:4
2-04:00)
Maven home: C:\apache-maven-3.2.2\bin\..
Java version: 1.7.0_25, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_25\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
C:\Temp\eclipse\workspace>cd\Temp\eclipse\workspace

**C:\Temp\eclipse\workspace>mvn -Declipse.workspace=<C:\Temp\eclipse\workspace> eclipse:add-maven-repo
Access is denied.
C:\Temp\eclipse\workspace>**

推荐答案

配置Maven以使其在Eclipse中运行.

Configuring Maven to run within Eclipse.

  1. Eclipse具有您可以使用的嵌入式Maven版本.假设要在Eclipse内外使用Maven,请从 http://maven.apache.org/download.cgi下载Maven. ,将其解压缩并设置 M2_HOME 环境变量,使其指向本地Maven安装目录.

  1. Eclipse has an embedded version of Maven which you can use. Assuming that you want to use Maven within Eclipse and outside of it, download Maven from http://maven.apache.org/download.cgi, extract it and set the M2_HOME environment variable such that it points to your local Maven installation directory.

设置 JAVA_HOME 环境变量,使其指向您要使用的JDK.

Set JAVA_HOME environment variable so that it points to the JDK which you want to use.

%JAVA_HOME%\ bin %M2_HOME%\ bin 附加到路径,以便可以在任何地方执行jdk和mvn可执行文件.

Append %JAVA_HOME%\bin and %M2_HOME%\bin to the Path so that the jdk and mvn executables can be executed from anywhere.

现在打开Eclipse工作区,然后转到窗口>首选项> Maven>安装.如果要使用独立安装而不是嵌入式安装,则可以在此处进行更改.

Now open an Eclipse Workspace and go to Window > Preferences > Maven > Installations. If you want to use your standalone installation instead of using the embedded one, you can change it here.

如果您要使用特定的Maven设置文件,则将该settings.xml文件转储到用户主目录的.m2文件夹下.

If you have a specific Maven settings file which you want to use, then dump that settings.xml file under the .m2 folder of your User home directory.

完成此操作后,您可以在eclipse中轻松使用Maven.(文件>导入> Maven>现有Maven项目)或创建一个新文件(文件>新建> Maven> Maven项目).一旦在工作区中有了一个项目,就可以通过右键单击该项目,然后从运行方式选项中选择所需的内容,在其上运行不同的Maven目标.

Once this is done, you can easily use Maven from within eclipse.(File > Import > Maven > Existing Maven Projects) or create a new one (File > New > Maven > Maven Project). Once you have a project in your workspace, you can run different Maven goals on it by right clicking on the Project and selecting what you want from the Run As option.

这篇关于如何配置Eclipse EE以使用外部Maven(Windows 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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