一、安装maven
maven的介绍:http://www.cnblogs.com/xdp-gacl/p/3498271.html
- 上传三个文件
- 安装maven
- 解压:
tar -zxf apache-maven-3.0.5-bin.tar.gz -C /opt/modules/
- 转到maven目录:
cd /opt/modules/apache-maven-3.0.5/
- 解压:
配置maven环境变量
sudo vi /etc/profile
##MAVEN_HOME export MAVEN_HOME=/opt/modules/apache-maven-3.0.5 export PATH=$PATH:$MAVEN_HOME/bin
使用管理员用户使之生效 source /etc/profile
source /etc/profile
验证
mvn -version
二、安装eclipse
解压eclipse
tar -zxf eclipse-jee-kepler-SR1-linux-gtk-x86_64.tar.gz -C /opt/tools/
启动eclipse
启动后更改工作目录 /opt/tools/workspace
在eclipse中安装maven
-
配置文件镜像地址为阿里云
/opt/modules/apache-maven-3.0.5/conf/settings.xml
<mirrors> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
拷贝配置文件到当前:
cp /opt/modules/apache-maven-3.0.5/conf/settings.xml .
解压并拷贝仓库包
tar -zxf /opt/software/repository.tar.gz -C /opt/modules/ cp -r /opt/modules/repository/ .
创建maven工程
指定输出路径
修改pom.xml文件
http://mvnrepository.com/artifact/org.apache.hadoop/hadoop-client/2.5.0<hadoop.version>2.5.0</hadoop.version>
<!-- https://mvnrepository.com/artifact/org.apache.hadoop/hadoop-client --> <dependency> <groupId>org.apache.hadoop</groupId> <artifactId>hadoop-client</artifactId> <version>2.5.0</version> </dependency>
- 最终结果