欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

maven3 下载配置 博客分类: maven maven3下载配置 

程序员文章站 2024-03-20 09:02:28
...

 

下载地址

http://maven.apache.org/download.cgi

Maven 3.3 requires JDK 1.7 or above to execute - it still allows you to build against 1.3 and other JDK versions by Using Toolchains 

 

Maven3.3需要JDK1.7,否则会报错

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0

 

要使用JDK1.6可以使用Maven3.2.x

apache-maven-3.2.5-bin.zip下载地址

http://download.csdn.net/detail/haveqing/9534322

 

历史版本说明 及JDK要求

http://maven.apache.org/docs/history.html

 

历史版本下载 不全

https://archive.apache.org/dist/maven/binaries/

 

在线文档

http://maven.apache.org/ref/3.2.5/

 

环境

Eclipse 3.7.2

JDK 1.6

 

安装

一.安装JDK,配置好JAVA_HOME,配置好PATH

JAVA_HOME

D:\Program Files (x86)\Java\jdk1.6.0_43

PATH

%JAVA_HOME%\bin;

测试

打开cmd

echo %Java_Home%

java -version

 

二.安装配置manen

1 将下载回来的包解压到任意地址,我的路径是D:\Program Files\apache-maven-3.2.5

2 新建环境变量M2_HOME 指向D:\Program Files\apache-maven-3.2.5

3 在path尾部添加;%M2_HOME%\bin

4 检查是否安装成功

打开cmd

echo %M2_HOME%

mvn –v

(mvn -version)

 

配置文件

D:\Program Files\apache-maven-3.2.5\conf\settings.xml

可配置本地仓库位置localRepository,默认是:用户目录\.m2\repository

以下3项可以不做

--可配置为<localRepository>${env.M2_HOME}/repository</localRepository>

--${env.M2_HOME}会引用你配置的环境变量,也可以直接写绝对路径

--(默认情况下,~/.m2目录下除了repository仓库之外就没有其他目录和文件了,不过大多数Maven用户需要复制M2_HOME/conf/settings.xml文件到~/.m2/settings.xml。这是一条最佳实践)

 

执行mvn help:system

这时候 maven 就会从远程仓库开始下载一大堆的东西,没事,让它下载着,迟早都要下载的。

 

三.Eclipse安装maven的插件 m2eclipse

 

离线安装包:

http://pan.baidu.com/s/1qW6mEnU 或

http://ishare.iask.sina.com.cn/f/36090147.html

在dropins目录下创建文件夹maven3

把解压出的features目录和plugins目录放到dropins下的maven3里就可以了,不用link方式。

目录

eclipse3.7

--plugins
--features
--links
------xxx.link(或者是xxx.txt)
--dropins
------xxx

----------plugins
----------features

 

重启eclipse

 

测试

eclipse windows--首选项中有Maven

 

----------------------------------------------------------------------------------------------------------

 

在线安装,有问题,没成功

1 打开eclipse

2 Help – Install New Software

Add

m2e

http://m2eclipse.sonatype.org/sites/m2e

此路径已改为以下路径
http://download.eclipse.org/technology/m2e/releases 

 

报错:

Cannot complete the install because one or more required items could not be found.
  Software being installed: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
  Missing requirement: Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.core.ui 1.4.0.20130601-0317) requires 'bundle org.slf4j.api 1.6.2' but it could not be found
  Cannot satisfy dependency:
    From: m2e logback appender 1.4.0.20130601-0317 (org.eclipse.m2e.logback.appender 1.4.0.20130601-0317)
    To: bundle org.eclipse.m2e.core.ui [1.4.0,1.5.0)
  Cannot satisfy dependency:
    From: m2e - slf4j over logback logging (Optional) 1.4.0.20130601-0317 (org.eclipse.m2e.logback.feature.feature.group 1.4.0.20130601-0317)
    To: org.eclipse.m2e.logback.appender [1.4.0.20130601-0317]

 

 

三、安装时出现问题: 
    直接在线安装maven2 会出现依赖插件找不到的问题,无法安装。必须先安装gef 插件后才能安装m2eclipse-core 插件,然而安装m2eclipse-extras 插件又依赖subclipse 插件。所以,三个插件的正确的安装顺序是:gef插件 》subclipse插件 》m2eclipse插件。
  m2eclipse-core插件 ——依赖——>gef插件 
  m2eclipse-extras插件 ——依赖——>subclipse插件

可能需要先安装gef插件和svn插件

1.4.1 先安装GEF插件

maven插件安装的时辰会依附这个插件,在Eclipse -> help -> Install New SoftWare中安装,

gef

http://download.eclipse.org/tools/gef/updates/interim/

1.4.2 安装SVN插件

Eclipse -> help -> Install New SoftWare中安装, site:http://subclipse.tigris.org/_1.6.x

 

安装完gef

还是报错:

Cannot complete the install because one or more required items could not be found.
  Software being installed: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
  Missing requirement: async-http-client 1.6.5.20130531-2315 (com.ning.async-http-client 1.6.5.20130531-2315) requires 'package org.slf4j 1.6.2' but it could not be found
  Cannot satisfy dependency:
    From: Maven Archetype Common Bundle 1.4.0.20130531-2315 (org.eclipse.m2e.archetype.common 1.4.0.20130531-2315)
    To: bundle org.eclipse.m2e.maven.runtime [1.4.0,1.5.0)
  Cannot satisfy dependency:
    From: m2e - Maven Integration for Eclipse 1.4.0.20130601-0317 (org.eclipse.m2e.feature.feature.group 1.4.0.20130601-0317)
    To: org.eclipse.m2e.archetype.common [1.4.0.20130531-2315]
  Cannot satisfy dependency:
    From: Embedded Maven Runtime Bundle 1.4.0.20130531-2315 (org.eclipse.m2e.maven.runtime 1.4.0.20130531-2315)
    To: bundle com.ning.async-http-client [1.6.5,1.6.6)