Install Maven3 on CentOS

Source: Internet
Author: User


Install Maven3 on CentOS 1. first confirm that the java environment has been installed: java-version www.2cto.com 2. download the latest Maven apache-maven-3.0.2-bin.tar.gz wget http://mirror.bjtu.edu.cn/apache//maven/binaries/apache-maven-3.0.2-bin.tar.gz 3. decompress to/usr/local/apache-maven-3.0.2 and create the link: ln-s apache-maven-3.0.2 maven 4. in ~ /. Add the following two lines to bashrc: www.2cto.com export M3_HOME =/usr/local/maven export PATH =$ {M3_HOME}/bin: $ {PATH} 5. run the following command to make the environment parameters take effect :. ~ /. Bashrc 6. check the mvn version to see if the configuration is correct: mvn-version www.2cto.com. If the display of Warning: JAVA_HOME environment variable is not set. apache Maven 3.0.2 (r1056850; 08:58:10 + 0800) Java version: 1.6.0 _ 17, vendor: Sun Microsystems Inc.
Java home:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jreDefault locale: en_US, platform encoding: UTF-8OS name: "linux", version: "2.6.18-194. el5 ", arch:" i386 ", family:" unix "is correct. If the JAVA_HOME parameter is not set, set it. Add export JAVA_HOME =/usr/lib/jvm/jre-1.6.0-openjdk/export CLASSPATH =.: $ JAVA_HOME/jre/lib/rt. jar: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jarexport PATH = $ PATH: $ JAVA_HOME/bin to the end of/etc/profile, and then. /etc/profile to make the settings take effect. 7. set/home/yourname/my-app as the project directory, but it can also be another location, and then execute: mvn archetype: create-DgroupId = com. mycompany. app-DartifactId = my-app 8. compile the test project: cd my-appmvn packagejava-cp target/my-app-1.0-SNAPSHOT.jar com. mycompany. app. if the App displays "Hello World!" The project configuration is correct. Be sure to run the command in the project directory. Otherwise, the pom. xml www.2cto.com 9. clean up the environment: mvn clean dependency: copy-dependencies package 10. Create a project site: mvn site

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.