[研究] Apache Maven 3.0.5 (yum) 安裝 (CentOS 7.0 x64_86)
2014-08-06
介紹
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.0 的 yum 提供 maven 3.0.5 版了
[root@localhost ~]# yum list | grep maven
buildnumber-maven-plugin.noarch 1.2-7.el7 base
buildnumber-maven-plugin-javadoc.noarch 1.2-7.el7 base
exec-maven-plugin.noarch 1.2.1-13.el7 base
exec-maven-plugin-javadoc.noarch 1.2.1-13.el7 base
jarjar-maven-plugin.noarch 1.4-6.el7 base
javacc-maven-plugin.noarch 2.6-17.el7 base
javacc-maven-plugin-javadoc.noarch 2.6-17.el7 base
jetty-jspc-maven-plugin.noarch 9.0.3-8.el7 base
jetty-maven-plugin.noarch 9.0.3-8.el7 base
jetty-version-maven-plugin.noarch 1.0.7-9.el7 base
jetty-version-maven-plugin-javadoc.noarch 1.0.7-9.el7 base
keytool-maven-plugin.noarch 1.0-13.el7 base
keytool-maven-plugin-javadoc.noarch 1.0-13.el7 base
maven.noarch 3.0.5-16.el7 base
maven-antrun-plugin.noarch 1.7-8.el7 base
maven-antrun-plugin-javadoc.noarch 1.7-8.el7 base
maven-archiver.noarch 2.5-9.el7 base
maven-archiver-javadoc.noarch 2.5-9.el7 base
maven-artifact.noarch 2.2.1-47.el7 base
maven-artifact-manager.noarch 2.2.1-47.el7 base
maven-artifact-resolver.noarch 1:1.0-10.el7 base
maven-artifact-resolver-javadoc.noarch 1:1.0-10.el7 base
maven-assembly-plugin.noarch 2.4-8.el7 base
maven-assembly-plugin-javadoc.noarch 2.4-8.el7 base
maven-cal10n-plugin.noarch 0.7.7-4.el7 base
maven-changes-plugin.noarch 2.8-7.el7 base
maven-changes-plugin-javadoc.noarch 2.8-7.el7 base
maven-clean-plugin.noarch 2.5-8.el7 base
maven-clean-plugin-javadoc.noarch 2.5-8.el7 base
maven-common-artifact-filters.noarch 1.4-11.el7 base
maven-common-artifact-filters-javadoc.noarch
maven-compiler-plugin.noarch 3.1-4.el7 base
maven-compiler-plugin-javadoc.noarch 3.1-4.el7 base
maven-dependency-analyzer.noarch 1.3-9.el7 base
maven-dependency-analyzer-javadoc.noarch 1.3-9.el7 base
maven-dependency-plugin.noarch 2.7-3.el7 base
maven-dependency-plugin-javadoc.noarch 2.7-3.el7 base
maven-dependency-tree.noarch 2.0-6.el7 base
maven-dependency-tree-javadoc.noarch 2.0-6.el7 base
maven-deploy-plugin.noarch 2.7-11.el7 base
maven-deploy-plugin-javadoc.noarch 2.7-11.el7 base
maven-downloader.noarch 1:1.1-6.el7 base
maven-downloader-javadoc.noarch 1:1.1-6.el7 base
maven-doxia.noarch 1.4-5.el7 base
maven-doxia-core.noarch 1.4-5.el7 base
maven-doxia-javadoc.noarch 1.4-5.el7 base
maven-doxia-logging-api.noarch 1.4-5.el7 base
maven-doxia-module-apt.noarch 1.4-5.el7 base
maven-doxia-module-confluence.noarch 1.4-5.el7 base
maven-doxia-module-docbook-simple.noarch 1.4-5.el7 base
maven-doxia-module-fml.noarch 1.4-5.el7 base
maven-doxia-module-fo.noarch 1.4-5.el7 base
maven-doxia-module-latex.noarch 1.4-5.el7 base
maven-doxia-module-rtf.noarch 1.4-5.el7 base
maven-doxia-module-twiki.noarch 1.4-5.el7 base
maven-doxia-module-xdoc.noarch 1.4-5.el7 base
maven-doxia-module-xhtml.noarch 1.4-5.el7 base
maven-doxia-modules.noarch 1.4-5.el7 base
maven-doxia-sink-api.noarch 1.4-5.el7 base
maven-doxia-sitetools.noarch 1.4-3.el7 base
maven-doxia-sitetools-javadoc.noarch 1.4-3.el7 base
maven-doxia-test-docs.noarch 1.4-5.el7 base
maven-doxia-tests.noarch 1.4-5.el7 base
maven-doxia-tools.noarch 1.4-14.el7 base
maven-doxia-tools-javadoc.noarch 1.4-14.el7 base
maven-ear-plugin.noarch 2.8-5.el7 base
maven-ear-plugin-javadoc.noarch 2.8-5.el7 base
maven-ejb-plugin.noarch 2.3-9.el7 base
maven-ejb-plugin-javadoc.noarch 2.3-9.el7 base
maven-enforcer.noarch 1.2-8.el7 base
maven-enforcer-api.noarch 1.2-8.el7 base
maven-enforcer-javadoc.noarch 1.2-8.el7 base
maven-enforcer-plugin.noarch 1.2-8.el7 base
maven-enforcer-rules.noarch 1.2-8.el7 base
maven-error-diagnostics.noarch 2.2.1-47.el7 base
maven-failsafe-plugin.noarch 2.15-3.el7 base
maven-file-management.noarch 1:1.2.1-8.el7 base
maven-file-management-javadoc.noarch 1:1.2.1-8.el7 base
maven-filtering.noarch 1.1-3.el7 base
maven-filtering-javadoc.noarch 1.1-3.el7 base
maven-gpg-plugin.noarch 1.4-11.el7 base
maven-gpg-plugin-javadoc.noarch 1.4-11.el7 base
maven-hawtjni-plugin.noarch 1.6-9.el7 base
maven-install-plugin.noarch 2.4-7.el7 base
maven-install-plugin-javadoc.noarch 2.4-7.el7 base
maven-invoker.noarch 2.1.1-9.el7 base
maven-invoker-javadoc.noarch 2.1.1-9.el7 base
maven-invoker-plugin.noarch 1.8-8.el7 base
maven-invoker-plugin-javadoc.noarch 1.8-8.el7 base
maven-istack-commons-plugin.noarch 2.17-4.el7 base
maven-jar-plugin.noarch 2.4-8.el7 base
maven-jar-plugin-javadoc.noarch 2.4-8.el7 base
maven-jarsigner-plugin.noarch 1.2-9.el7 base
maven-jarsigner-plugin-javadoc.noarch 1.2-9.el7 base
maven-javadoc.noarch 3.0.5-16.el7 base
maven-javadoc-plugin.noarch 2.9-8.el7 base
maven-javadoc-plugin-javadoc.noarch 2.9-8.el7 base
maven-jxr.noarch 2.3-11.el7 base
maven-jxr-javadoc.noarch 2.3-11.el7 base
maven-local.noarch 3.4.1-5.el7 base
maven-model.noarch 2.2.1-47.el7 base
maven-monitor.noarch 2.2.1-47.el7 base
maven-osgi.noarch 1:0.2.0-7.el7 base
maven-osgi-javadoc.noarch 1:0.2.0-7.el7 base
maven-parent.noarch 20-5.el7 base
maven-plugin-annotations.noarch 3.1-17.el7 base
maven-plugin-build-helper.noarch 1.5-13.el7 base
maven-plugin-build-helper-javadoc.noarch 1.5-13.el7 base
maven-plugin-bundle.noarch 2.3.7-12.el7 base
maven-plugin-bundle-javadoc.noarch 2.3.7-12.el7 base
maven-plugin-descriptor.noarch 2.2.1-47.el7 base
maven-plugin-jxr.noarch 2.3-11.el7 base
maven-plugin-plugin.noarch 3.1-17.el7 base
maven-plugin-registry.noarch 2.2.1-47.el7 base
maven-plugin-testing.noarch 2.1-11.el7 base
maven-plugin-testing-harness.noarch 2.1-11.el7 base
maven-plugin-testing-javadoc.noarch 2.1-11.el7 base
maven-plugin-testing-tools.noarch 2.1-11.el7 base
maven-plugin-tools.noarch 3.1-17.el7 base
maven-plugin-tools-annotations.noarch 3.1-17.el7 base
maven-plugin-tools-ant.noarch 3.1-17.el7 base
maven-plugin-tools-api.noarch 3.1-17.el7 base
maven-plugin-tools-beanshell.noarch 3.1-17.el7 base
maven-plugin-tools-generators.noarch 3.1-17.el7 base
maven-plugin-tools-java.noarch 3.1-17.el7 base
maven-plugin-tools-javadoc.noarch 3.1-17.el7 base
maven-plugin-tools-javadocs.noarch 3.1-17.el7 base
maven-plugin-tools-model.noarch 3.1-17.el7 base
maven-plugins-pom.noarch 23-7.el7 base
maven-profile.noarch 2.2.1-47.el7 base
maven-project.noarch 2.2.1-47.el7 base
maven-project-info-reports-plugin.noarch 2.6-8.el7 base
maven-project-info-reports-plugin-javadoc.noarch
maven-release.noarch 2.2.1-12.el7 base
maven-release-javadoc.noarch 2.2.1-12.el7 base
maven-release-manager.noarch 2.2.1-12.el7 base
maven-release-plugin.noarch 2.2.1-12.el7 base
maven-remote-resources-plugin.noarch 1.4-7.el7 base
maven-remote-resources-plugin-javadoc.noarch
maven-reporting-api.noarch 1:3.0-5.el7 base
maven-reporting-api-javadoc.noarch 1:3.0-5.el7 base
maven-reporting-exec.noarch 1.1-4.el7 base
maven-reporting-impl.noarch 2.2-8.el7 base
maven-reporting-impl-javadoc.noarch 2.2-8.el7 base
maven-repository-builder.noarch 1:1.0-0.5.alpha2.el7 base
maven-repository-builder-javadoc.noarch 1:1.0-0.5.alpha2.el7 base
maven-resources-plugin.noarch 2.6-6.el7 base
maven-resources-plugin-javadoc.noarch 2.6-6.el7 base
maven-scm.noarch 1.8.1-2.el7 base
maven-scm-javadoc.noarch 1.8.1-2.el7 base
maven-scm-test.noarch 1.8.1-2.el7 base
maven-script.noarch 3.1-17.el7 base
maven-script-ant.noarch 3.1-17.el7 base
maven-script-beanshell.noarch 3.1-17.el7 base
maven-script-interpreter.noarch 1.0-6.el7 base
maven-script-interpreter-javadoc.noarch 1.0-6.el7 base
maven-settings.noarch 2.2.1-47.el7 base
maven-shade-plugin.noarch 2.0-6.el7 base
maven-shade-plugin-javadoc.noarch 2.0-6.el7 base
maven-shared.noarch 19-4.el7 base
maven-shared-incremental.noarch 1.1-6.el7 base
maven-shared-incremental-javadoc.noarch 1.1-6.el7 base
maven-shared-io.noarch 1:1.1-7.el7 base
maven-shared-io-javadoc.noarch 1:1.1-7.el7 base
maven-shared-jar.noarch 1:1.1-7.el7 base
maven-shared-jar-javadoc.noarch 1:1.1-7.el7 base
maven-shared-utils.noarch 0.4-3.el7 base
maven-shared-utils-javadoc.noarch 0.4-3.el7 base
maven-site-plugin.noarch 3.2-7.el7 base
maven-site-plugin-javadoc.noarch 3.2-7.el7 base
maven-source-plugin.noarch 2.2.1-7.el7 base
maven-source-plugin-javadoc.noarch 2.2.1-7.el7 base
maven-surefire.noarch 2.15-3.el7 base
maven-surefire-javadoc.noarch 2.15-3.el7 base
maven-surefire-plugin.noarch 2.15-3.el7 base
maven-surefire-provider-junit.noarch 2.15-3.el7 base
maven-surefire-provider-testng.noarch 2.15-3.el7 base
maven-surefire-report-parser.noarch 2.15-3.el7 base
maven-surefire-report-plugin.noarch 2.15-3.el7 base
maven-test-tools.noarch 2.1-11.el7 base
maven-toolchain.noarch 2.2.1-47.el7 base
maven-verifier.noarch 1.4-6.el7 base
maven-verifier-javadoc.noarch 1.4-6.el7 base
maven-verifier-plugin.noarch 1.0-10.el7 base
maven-verifier-plugin-javadoc.noarch 1.0-10.el7 base
maven-wagon.noarch 2.4-3.el7 base
maven-wagon-javadoc.noarch 2.4-3.el7 base
maven-wagon-provider-test.noarch 2.4-3.el7 base
maven-wagon-scm.noarch 2.4-3.el7 base
maven-war-plugin.noarch 2.3-9.el7 base
maven-war-plugin-javadoc.noarch 2.3-9.el7 base
maven2-javadoc.noarch 2.2.1-47.el7 base
munge-maven-plugin.noarch 1.0-2.el7 base
munge-maven-plugin-javadoc.noarch 1.0-2.el7 base
sisu-maven-plugin.noarch 1.1-8.el7 base
sisu-maven-plugin-javadoc.noarch 1.1-8.el7 base
[root@localhost ~]#
安裝比 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_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el7_0.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.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] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4:02.630s
[INFO] Finished at: Wed Aug 06 21:21:13 CST 2014
[INFO] Final Memory: 11M/32M
[INFO] ------------------------------------------------------------------------
[root@localhost ~]#
編譯測試
[root@localhost ~]# cd my-app
[root@localhost my-app]# mvn compile
...(略)
[INFO] Compiling 1 source file to /root/my-app/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.727s
[INFO] Finished at: Wed Aug 06 21:22:27 CST 2014
[INFO] Final Memory: 9M/25M
[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: 20.766s
[INFO] Finished at: Wed Aug 06 21:23:34 CST 2014
[INFO] Final Memory: 11M/26M
[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.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
沒有留言:
張貼留言