现在的位置: 首页 > 综合 > 正文

eclipse 安装 maven插件

2017年11月14日 ⁄ 综合 ⁄ 共 2802字 ⁄ 字号 评论关闭

首先本地配置maven,

官网下载你需要的版本,地址如右点击打开链接

我下载的是 source zip文件,解压下,放到自己想放的地方。。举例 d:/abc/apache-maven-3.2.3

之后就是配置环境变量了。。哦,这个之前你得确保你的电脑上已经JDK配置完成。。一般学java的,android的这环境应该都是配置好的吧。

环境变量的配置,上边的链接页面最先放有,我复制过来。。

Windows

  1. Unzip the distribution archive, i.e. apache-maven-3.2.3-bin.zip to the directory you wish to install Maven 3.2.3. These instructions assume you chose C:\Program Files\Apache Software Foundation.
    The subdirectory apache-maven-3.2.3 will be created from the archive.
  2. Add the M2_HOME environment variable by opening up the system properties (WinKey + Pause), selecting the "Advanced" tab, and the "Environment Variables" button, then adding the M2_HOME variable
    in the user variables with the value C:\Program Files\Apache Software Foundation\apache-maven-3.2.3. Be sure to omit any quotation marks around the path even if it contains spaces. Note: For Maven 2.0.9, also be sure that the M2_HOME doesn't
    have a '\' as last character.
  3. In the same dialog, add the M2 environment variable in the user variables with the value %M2_HOME%\bin.
  4. Optional: In the same dialog, add the MAVEN_OPTS environment variable in the user variables to specify JVM properties, e.g. the value -Xms256m -Xmx512m. This environment variable
    can be used to supply extra options to Maven.
  5. In the same dialog, update/create the Path environment variable in the user variables and prepend the value %M2% to add Maven available in the command line.
  6. In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK, e.g. C:\Program Files\Java\jdk1.7.0_51 and that %JAVA_HOME%\bin is
    in your Path environment variable.
  7. Open a new command prompt (Winkey + R then type cmd) and run mvn --version to verify that it is correctly installed.

简单那点来说就是:

系统变量:MAVEN_HOME = d:/abc/apache-maven-3.2.3

  用户变量:path = %MAVEN_HOME%\bin 这个是在path前边添加的,加完记得加个分号。

配置好了,在dos下输入如下的命令 mvn -version 

如果出现版本信息说明配置成功的哦!

===========修改下maven的仓储位置,你不想修改也行。。没啥影响,他默认是在 C:\Users\top\.m2这里的,top是我电脑的名字

找到如下的目录,【你按上边自己放的位置找】d:/abc/apache-maven-3.2.3\conf

下边有个setting.xml文件,打开。。修改如下的地方,添加红色的地方,这个路径自己随便弄的,你想把仓储放哪就把路径复制过来

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
<localRepository>D:\hahah\aaaaa</localRepository>

==========完事再dos下输入如下的命令  mvn help:system

看到会下载一堆东西,没多大也就10来M吧。。


接下来可以安装插件了。。。

在线的我的不成功,所以这里就写下离线的安装。。

找到eclipse的目录,下边一般有我选中的那2个目录,没有自己建一个。。。

去这里下载 点击打开链接

下完解压,可以看到有2个目录,名字就是上边的  feature 和 plugin ,复制里边的东西到上边2个对应的目录下就好了。。。

完事重启下eclipse,就ok啦

依次打开 windows--preferences-如下图就看到了,maven出来了。。

点击右边的add,选择你的maven的目录。就是官网下载的那个。。

这里的setting,我们选择自己设置的那个,,就是上个maven目录下的config目录下的那个setting。。

参考:http://www.blogjava.net/fancydeepin/archive/2012/07/13/eclipse_maven3_plugin.html

抱歉!评论已关闭.