Maven project construction and the first helloworld (Multi-graph)

Source: Internet
Author: User

This record is the first process to build a Maven helloworld.

Reprinted

1. to build a web project, you must create a new Maven project. If you do not directly see the maven project in the project, select other and search Maven in the search box under wizards. Then, the maven folder appears, click Open, find the maven project, and click Next.


2. Click Next again;


3. Select org. Apache. Maven. archetypes Maven-Archetype-webapps and click Next again.


4. In group ID, enter the com. company name. In artifact ID, enter the project name. After filling in the information and no error is reported, click Finish to complete the initial creation.

Groupid: the group is translated into Chinese as the group and group consciousness. groupid is the ID of such a group or group. Let's talk about it with Apache. It's no stranger to Apache,

There are many projects on the Apache official website. You can find org. Apache. xxxx in each project, and org. Apache is the groupid mentioned here.

Artifactid: for Apache, there are many projects on the Apache official website. The name of each project is artifactid. In other words, artifactid is your project name.

Version: There is nothing to explain. It is the meaning of the project version.

Package

 



6. But this is not the standard structure of the default Maven project. We need to make some changes.

(1) create a source folder under the project; Folder name: src/main/Java


7. the error cannot nest 'ss/src/main/Java 'inside 'SS/src/' may be reported /'. to enable the nesting exclude 'main/'from 'ss/src /';


8. Click the properties attribute of the project to select the Java build path, find the source, find two wrong packages, and remove them;


9. Create a source folder again under the project; Folder name: src/main/Java

No pom modification, no configuration added to Pom, no result of Java program run on server


10. OK. At this time, our web project has been initially set up, and the rest is to modify the configuration file as needed.

Description of parameters in the POM File

<Project xmlns = "http://maven.apache.org/POM/4.0.0" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <! -- Specifies the version of the object model used by POM. This value is rarely changed --> <modelversion> 4.0.0 </modelversion> <! -- Groupid --> <groupid> com. Hello. MAVEN </groupid> <! -- Artifactid --> <artifactid> hellomaven </artifactid> <! -- Project product version --> <version> 0.0.1-Snapshot </version> <! -- Packaging method --> <packaging> jar </packaging> <! -- Project display name --> <Name> hellomaven </Name> <! -- Project Site --> <URL> http://286.iteye.com/</URL> <! -- Property settings --> <Properties> <project. Build. sourceencoding> UTF-8 </Project. Build. sourceencoding> </Properties> <! -- Dependency --> <dependencies> <dependency> <groupid> JUnit </groupid> <artifactid> JUnit </artifactid> <version> 3.8.1 </version> <scope> test </scope> </dependency> </dependencies> <! -- The default compiler is used here --> <build> <defagogoal> compile </defaultgoal> </build> </Project>

Pom file of Maven Project

What is Pom?
Pom serves as the project object model. The Maven project is represented in XML and implemented using Pom. xml. It mainly describes projects, including configuration files, rules to be followed by developers, defect management systems, organizations and licenses, project URLs, project dependencies, and all other project-related factors.

Maven project construction and the first helloworld (Multi-graph)

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.