您好,登錄后才能下訂單哦!
本篇內容主要講解“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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。