Maven Tutorial Getting Started MAVEN configuration management compiling Java programs

Source: Internet
Author: User

Method/Step

  1. 1

    Create the Maven folder on the E drive first,

    Then create the maven0703 folder in Maven

    Finally, create the SRC folder and the Pom.xml file under maven0703

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://f.hiphotos.baidu.com/ Exp/w=500/sign=ea7aed14184c510faec4e21a50582528/30adcbef76094b36c1912831a1cc7cd98c109dee.jpg "/> steps to read

  2. 2

    Create the Pom.xml file and add the following information to the file:

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://e.hiphotos.baidu.com/ Exp/w=500/sign=38989c02f21f3a295ac8d5cea927bce3/c8177f3e6709c93dc403332b9d3df8dcd000547c.jpg "/> steps to read

  3. 3

    Then create under SRC: Main and Test folder

    Main Next Create: Hello.java file stored in Java/com/liu/maven/hello.java

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://d.hiphotos.baidu.com/ Exp/w=500/sign=b410a86785d6277fe912323818391f63/472309f790529822411f051fd5ca7bcb0a46d439.jpg "/> steps to read

  4. 4

    Create the Hello.java file and add the following code below:

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://b.hiphotos.baidu.com/ Exp/w=500/sign=9a57b9bdfa1986184147ef847aec2e69/503d269759ee3d6d7cb7bb1741166d224e4adefc.jpg "/> steps to read

  5. 5

    Compile the Java file, first open the DOS window:

    Enter the following command: C:\Documents and settings\zyb> E:

     

    E:\> cd E:\maven\maven0703

     

    And then in input mvn compile

     

    E:\maven\maven0703> mvn compile

     

     

     

     

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src="/HTTP/ g.hiphotos.baidu.com/exp/w=500/sign=2b9f5b3683cb39dbc1c06756e01709a7/ 8326cffc1e178a824f5a407cf403738da877e88c.jpg "/> step to read

  6. 6

    After the command executes, create a target file and compile the Java file into a class file:

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://f.hiphotos.baidu.com/ Exp/w=500/sign=7e9b88ee58afa40f3cc6cedd9b65038c/267f9e2f07082838125be3c8ba99a9014d08f193.jpg "/> steps to read

  7. 7

    Packaging in the input MVN Package Object Project

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://f.hiphotos.baidu.com/ Exp/w=500/sign=0a36494bdb33c895a67e987be1127397/4bed2e738bd4b31c8213aa6785d6277f9e2ff83a.jpg "/> steps to read

  8. 8

    After execution, a jar package is generated below the target folder:Maven0703-1.0.0.jar

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://g.hiphotos.baidu.com/ Exp/w=500/sign=4c8fadf2aad3fd1f3609a23a004f25ce/50da81cb39dbb6fd9c62dbfa0b24ab18972b3734.jpg "/> steps to read

  9. 9

    Then enter the java-cp target/maven0703-1.0.0.jar Com.liu.maven.Hello

    Print result information:

    650) this.width=650; "class=" Exp-image-default "alt=" maven tutorial Getting Started MAVEN configuration management compiling Java program "src=" http://e.hiphotos.baidu.com/ Exp/w=500/sign=8e942619e2fe9925cb0c695004aa5ee4/c83d70cf3bc79f3d4c61daecb8a1cd11738b296d.jpg "/> steps to read

    END

Baidu Experience: jingyan.baidu.com

Precautions
    • If you run the command for the first time, MVN compile, take a moment to download the latest toolkit (Maven calls it artifacts) to your local repository

This article is from the "Yang Hailong blog" blog, make sure to keep this source http://7218743.blog.51cto.com/7208743/1618418

Maven Tutorial Getting Started MAVEN configuration management compiling Java programs

Related Article

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.