本篇内容主要讲解“maven-3.3.9如何安装”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“maven-3.3.9如何安装”吧!
1.Java版本1.8
[root@sht-sgmhadoopdn-04 app]# java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
[root@sht-sgmhadoopdn-04 app]#
2.maven-3.3.9安装
[root@sht-sgmhadoopdn-04 app]# wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
[root@sht-sgmhadoopdn-04 app]# tar -xzvf apache-maven-3.3.9-bin.tar.gz
[root@sht-sgmhadoopdn-04 app]# ln -s apache-maven-3.3.9 maven
[root@sht-sgmhadoopdn-04 app]# vi /etc/profile
M2_HOME=/root/learnproject/app/maven
PATH=$M2_HOME/bin:$PATH
[root@sht-sgmhadoopdn-04 app]# source /etc/profile
[root@sht-sgmhadoopdn-04 app]# mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /root/learnproject/app/maven
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: /usr/java/jdk1.7.0_67-cloudera/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-431.el6.x86_64", arch: "amd64", family: "unix"
[root@sht-sgmhadoopdn-04 app]#
3.修改maven的仓库设置
#这里我们需要编译oozie,所以不用阿里云仓库(很多依赖不全),改成使用maven的中央仓库。
[root@sht-sgmhadoopdn-04 app]# cd /root/learnproject/app/maven/conf
[root@sht-sgmhadoopdn-04 conf]# vi settings.xml
点击(此处)折叠或打开
<mirror>
<id>Central</id>
<mirrorOf>*</mirrorOf>
<name>Central</name>
<url>http://central.maven.org/maven2/</url>
</mirror>
<!-- 阿里云镜像 -->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
4.oozie-4.3.0源代码文件下载解压
[root@sht-sgmhadoopdn-04 app]# mkdir oozie_source
[root@sht-sgmhadoopdn-04 app]# cd oozie_source
[root@sht-sgmhadoopdn-04 oozie_source]# wget http://apache.fayea.com/oozie/4.3.0/oozie-4.3.0.tar.gz
[root@sht-sgmhadoopdn-04 oozie_source]# tar -xzvf oozie-4.3.0.tar.gz
5.修改pom.xml,改为1.8
[root@sht-sgmhadoopdn-04 oozie_source]# cd oozie-4.3.0
[root@sht-sgmhadoopdn-04 oozie_source]# vi pom.xml
点击(此处)折叠或打开
<targetJavaVersion>1.8</targetJavaVersion>
<sourceJavaVersion>1.8</sourceJavaVersion>
<minJavaVersion>1.7</minJavaVersion>
6.第一次编译
[root@sht-sgmhadoopdn-04 oozie_source]# bin/mkdistro.sh -DskipTests -Puber -Phadoop-2 \
-Dhadoop.version=2.7.2 \
-Dhadoop.auth.version=2.7.2 \
-Ddistcp.version=2.7.2 \
-Dsqoop.version=1.4.3 \
-Dhive.version=1.2.0 \
-Dhbase.version=0.94.27
.........
.........
[INFO] Final Memory: 112M/606M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project oozie-core: Could not resolve dependencies for project org.apache.oozie:oozie-core:jar:4.3.0:
Could not find artifact org.pentaho:pentaho-aggdesigner-algorithm:jar:5.1.5-jhyde in Central (http://central.maven.org/maven2/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :oozie-core
7.Could not find artifact org.pentaho:pentaho-aggdesigner-algorithm:jar:5.1.5-jhyde in Central
7.1下载不了该jar包 我就手工下载,先找到下载地址,就会发现该jar包来源根本不是maven的central仓库,而是spring
http://repo.spring.io/plugins-release/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar
7.2 进机器的~/.m2/repository/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/,清除,手工上传win7下载好的jar包
[root@sht-sgmhadoopdn-04 5.1.5-jhyde]# rm -rf *
[root@sht-sgmhadoopdn-04 5.1.5-jhyde]# wget http://repo.spring.io/plugins-release/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar
[root@sht-sgmhadoopdn-04 5.1.5-jhyde]# ll
total 48
-rw-r--r-- 1 root root 48557 Apr 25 16:44 pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar
[root@sht-sgmhadoopdn-04 5.1.5-jhyde]#
8.第二次编译
[root@sht-sgmhadoopdn-04 oozie_source]# bin/mkdistro.sh -DskipTests -Puber -Phadoop-2 \
-Dhadoop.version=2.7.2 \
-Dhadoop.auth.version=2.7.2 \
-Ddistcp.version=2.7.2 \
-Dsqoop.version=1.4.3 \
-Dhive.version=1.2.0 \
-Dhbase.version=0.94.27
.........
.........
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:2.0-beta-6:site (default) on project oozie-docs:
Execution default of goal org.apache.maven.plugins:maven-site-plugin:2.0-beta-6:site failed: Plugin org.apache.maven.plugins:maven-site-plugin:2.0-beta-6 or one of its dependencies
could not be resolved: The following artifacts could not be resolved: org.apache.maven.doxia:doxia-module-twiki:jar:1.0-alpha-9.2y,
org.apache.maven.doxia:doxia-core:jar:1.0-alpha-9.2y: Could not find artifact org.apache.maven.doxia:doxia-module-twiki:jar:1.0-alpha-9.2y
in Central (http://central.maven.org/maven2/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :oozie-docs
9. could not be resolved: org.apache.maven.doxia:doxia-module-twiki:jar:1.0-alpha-9.2y, org.apache.maven.doxia:doxia-core:jar:1.0-alpha-9.2y
9.1下载不了该jar包 我就手工下载,先找到下载地址,就会发现该jar包来源根本不是maven的central仓库,而是cloudera
doxia-module-twiki-1.0-alpha-9.2y.jar:
https://repository.cloudera.com/content/repositories/releases/org/apache/maven/doxia/doxia-module-twiki/1.0-alpha-9.2y/doxia-module-twiki-1.0-alpha-9.2y.jar
doxia-core-1.0-alpha-9.2y.jar:
https://repository.cloudera.com/content/repositories/releases/org/apache/maven/doxia/doxia-core/1.0-alpha-9.2y/doxia-core-1.0-alpha-9.2y.jar
9.2进~/.m2/repository/org/apache/maven/doxia/doxia-module-twiki/1.0-alpha-9.2y,下载 doxia-module-twiki-1.0-alpha-9.2y.jar
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# pwd
/root/.m2/repository/org/apache/maven/doxia/doxia-module-twiki/1.0-alpha-9.2y
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# rm -rf *
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# wget https://repository.cloudera.com/content/repositories/releases/org/apache/maven/doxia/doxia-module-twiki/1.0-alpha-9.2y/doxia-module-twiki-1.0-alpha-9.2y.jar --no-check-certificate
9.3进~/.m2/repository/org/apache/maven/doxia/doxia-core/1.0-alpha-9.2y,下载 doxia-core-1.0-alpha-9.2y.jar:
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# pwd
/root/.m2/repository/org/apache/maven/doxia/doxia-module-twiki
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# rm -rf *
[root@sht-sgmhadoopdn-04 1.0-alpha-9.2y]# wget https://repository.cloudera.com/content/repositories/releases/org/apache/maven/doxia/doxia-core/1.0-alpha-9.2y/doxia-core-1.0-alpha-9.2y.jar --no-check-certificate
9.第三次编译
[root@sht-sgmhadoopdn-04 oozie_source]# bin/mkdistro.sh -DskipTests -Puber -Phadoop-2 \
-Dhadoop.version=2.7.2 \
-Dhadoop.auth.version=2.7.2 \
-Ddistcp.version=2.7.2 \
-Dsqoop.version=1.4.3 \
-Dhive.version=1.2.0 \
-Dhbase.version=0.94.27
........
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Oozie Main .................................. SUCCESS [ 2.121 s]
[INFO] Apache Oozie Hadoop Utils hadoop-2-4.3.0 ........... SUCCESS [ 3.706 s]
[INFO] Apache Oozie Hadoop Distcp hadoop-2-4.3.0 .......... SUCCESS [ 0.178 s]
[INFO] Apache Oozie Hadoop Auth hadoop-2-4.3.0 Test ....... SUCCESS [ 0.781 s]
[INFO] Apache Oozie Hadoop Libs ........................... SUCCESS [ 0.043 s]
[INFO] Apache Oozie Client ................................ SUCCESS [ 24.672 s]
[INFO] Apache Oozie Share Lib Oozie ....................... SUCCESS [ 3.791 s]
[INFO] Apache Oozie Share Lib HCatalog .................... SUCCESS [ 5.554 s]
[INFO] Apache Oozie Share Lib Distcp ...................... SUCCESS [ 1.478 s]
[INFO] Apache Oozie Core .................................. SUCCESS [01:24 min]
[INFO] Apache Oozie Share Lib Streaming ................... SUCCESS [ 6.369 s]
[INFO] Apache Oozie Share Lib Pig ......................... SUCCESS [ 7.963 s]
[INFO] Apache Oozie Share Lib Hive ........................ SUCCESS [ 9.024 s]
[INFO] Apache Oozie Share Lib Hive 2 ...................... SUCCESS [ 7.739 s]
[INFO] Apache Oozie Share Lib Sqoop ....................... SUCCESS [ 3.303 s]
[INFO] Apache Oozie Examples .............................. SUCCESS [ 7.334 s]
[INFO] Apache Oozie Share Lib Spark ....................... SUCCESS [ 11.843 s]
[INFO] Apache Oozie Share Lib ............................. SUCCESS [ 29.395 s]
[INFO] Apache Oozie Docs .................................. SUCCESS [ 16.603 s]
[INFO] Apache Oozie WebApp ................................ SUCCESS [01:23 min]
[INFO] Apache Oozie Tools ................................. SUCCESS [ 5.716 s]
[INFO] Apache Oozie MiniOozie ............................. SUCCESS [ 3.058 s]
[INFO] Apache Oozie Distro ................................ SUCCESS [01:05 min]
[INFO] Apache Oozie ZooKeeper Security Tests .............. SUCCESS [ 20.784 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 06:47 min
[INFO] Finished at: 2017-04-25T17:32:58+08:00
[INFO] Final Memory: 581M/1067M
[INFO] ------------------------------------------------------------------------
Oozie distro created, DATE[2017.04.25-09:26:09GMT] VC-REV[unavailable], available at [/root/learnproject/app/oozie-source/oozie-4.3.0/distro/target]
10.生成的文件oozie-4.3.0-distro.tar.gz
[root@sht-sgmhadoopdn-04 oozie-4.3.0]# cd /root/learnproject/app/oozie-source/oozie-4.3.0/distro/target
[root@sht-sgmhadoopdn-04 target]# ll
total 440024
drwxr-xr-x 2 root root 4096 Apr 25 17:31 antrun
drwxr-xr-x 2 root root 4096 Apr 25 17:31 archive-tmp
drwxr-xr-x 3 root root 4096 Apr 25 17:31 classes
drwxr-xr-x 2 root root 4096 Apr 25 17:31 maven-archiver
drwxr-xr-x 3 root root 4096 Apr 25 17:31 maven-shared-archive-resources
drwxr-xr-x 3 root root 4096 Apr 25 17:32 oozie-4.3.0-distro
-rw-r--r-- 1 root root 450528886 Apr 25 17:32 oozie-4.3.0-distro.tar.gz
-rw-r--r-- 1 root root 14458 Apr 25 17:31 oozie-distro-4.3.0.jar
drwxr-xr-x 3 root root 4096 Apr 25 17:31 test-classes
drwxr-xr-x 3 root root 4096 Apr 25 17:31 tomcat
[root@sht-sgmhadoopdn-04 target]# ll oozie-4.3.0-distro.tar.gz
-rw-r--r-- 1 root root 450528886 Apr 25 17:32 oozie-4.3.0-distro.tar.gz
You have mail in /var/spool/mail/root
[root@sht-sgmhadoopdn-04 target]#
到此,相信大家对“maven-3.3.9如何安装”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。