Step by step to teach you to use Maven to build an SSH framework

Source: Internet
Author: User

One, download and install Maven

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

After decompression. Configure MAVEN's directory to Maven_home and add the%maven_home%\bin directory to the path

Then in the input MVN--version see if MAVEN was installed successfully.

Second, install the Maven-eclipse plugin

Use link to install, first download plugin http://download.csdn.net/download/qq185501667/7076183

Then unzip him, then under the Eclipse installation directory, create a new folder named links (the name does not matter), and then create a new Maven.link file inside, write to: Path=e:/eclipseplugins/maven (Your plugin directory To restart Eclipse, if you see the Welcome page, the installation is successful.

Third, new MAVEN project

Create a new parent module first

Select Maven Project

Next, and then direct the next step, do not tick create simple project, then go to the Archetype page, and select the default Maven-archetype-quickstart directly. Finally, fill in the GroupID (fill in the workgroup ID, for example, Org.zyx) Artifactid (you can fill in the project name, such as MyApp). The name of the package will not be said.

and then complete. Then modify the Pom.xml file, because our goal is to create a modular Web application, our current new is the parent module, it does not need a real build, is responsible for the organization of the child module, so the packaging to modify

[HTML] view plain copy <span style= "FONT-SIZE:14PX;" ><packaging>pom</packaging></span>

Four, new entity

Right-click New on parent item, select Maven module, and the rest ibid.

Because this project uses annotations to configure the Hibernate entity, the dependent dependencies of the annotation package are added

Modify Pom.xml, add [HTML] view plain copy <span style= "FONT-SIZE:14PX;" > <dependencies> <dependency> <GROUPID>ORG.HIBERNATE.JAVAX.PERSISTENCE&L T;/groupid> <artifactId>hibernate-jpa-2.0-api</artifactId> <version>1 .0.0.final</version> </dependency> </dependencies></span>
So maven will help us import the relevant jar pack, and if we go inside the Class,maven will also automatically download the source code for us.

New entity classes below:

Create a new class in the Src/main/java directory [Java] view plain copy <span style= "FONT-SIZE:14PX;"      >package com.zyx.model.entity;      Import java.util.List;   Import Javax.persistence.CascadeType;   Import Javax.persistence.Column;   Import javax.persistence.Entity;   Import Javax.persistence.GeneratedValue;   Import Javax.persistence.Id;   Import Javax.persistence.OneToMany;      Import javax.persistence.Table; @Entity @Table (name = "T_user") public class USER {private

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.