2015年5月23日 星期六

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.1 x64_86)

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.1 x64_86)

2015-05-23

介紹
http://maven.apache.org/

Maven是一個專案的開發,管理和綜合工具。

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

參考
http://maven.apache.org/download.cgi#Installation

使用教學
http://maven.apache.org/guides/getting-started/index.html
http://maven.apache.org/guides/index.html

CentOS 7.1 的 yum 提供 maven 3.0.5 版了,安裝比 CentOS 6.x 容易很多 (環境變數設定非必須,下面會自動安裝 OpenJDK 1.7)

yum  -y  install  maven

測試

顯示版本

[root@localhost ~]# mvn -version
Apache Maven 3.0.5 (Red Hat 3.0.5-16)
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.79-2.5.5.1.el7_1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-229.el7.x86_64", arch: "amd64", family: "unix"
[root@localhost ~]#


下載測試 (過程所有問題按下 Enter 回答)

[root@localhost ~]# mvn archetype:generate \
  -DarchetypeGroupId=org.apache.maven.archetypes \
  -DgroupId=com.mycompany.app \
  -DartifactId=my-app

... (略)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:32.026s
[INFO] Finished at: Sat May 23 19:01:44 CST 2015
[INFO] Final Memory: 12M/42M
[INFO] ------------------------------------------------------------------------
[root@localhost ~]#

編譯測試

[root@localhost ~]# cd  my-app
[root@localhost my-app]# mvn compile

...(略)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.579s
[INFO] Finished at: Sat May 23 19:02:43 CST 2015
[INFO] Final Memory: 9M/27M
[INFO] ------------------------------------------------------------------------

[root@localhost my-app]# mvn test

...(略)

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18.856s
[INFO] Finished at: Sat May 23 19:03:16 CST 2015
[INFO] Final Memory: 11M/27M
[INFO] ------------------------------------------------------------------------

[root@localhost my-app]#


其他使用教學請看
http://maven.apache.org/guides/getting-started/index.html
http://maven.apache.org/guides/index.html

(完)
[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.1 x64_86)
http://shaurong.blogspot.com/2015/05/apache-maven-305-yum-centos-71-x6486.html

[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.0 x64_86)
http://shaurong.blogspot.com/2014/08/apache-maven-305-yum-centos-70-x6486.html

[研究] Apache Maven 3.1.1 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.com/2013/11/apache-maven-311-centos-64-x64.html
http://forum.icst.org.tw/phpbb/viewtopic.php?t=80036

[研究] Apache Maven 3.0.3 (yum) 安裝 (CentOS 6.4 x64)
http://shaurong.blogspot.tw/2013/11/apache-maven-303-yum-centos-64-x64.html

沒有留言:

張貼留言