[Go] Build multi-module enterprise project

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/quanyongan/archive/2013/05/28/3103243.html

First, several previous studies have learned to install MAVEN, how to create a MAVEN project, and so on, the recent study, finally a little progress, build enterprise-Class multi-module projects.

Well, nonsense not much to say, specifically as follows:

Start with a new Maven project, pom.xml files as follows:

To build a multi-module project, you must have a packaging root directory for the Pom. After creating this MAVEN project, we right-click on the project-->new

Enter the name of your project

There is no repetition of the creation of the project, and the creation of a good directory structure in Eclipse is as follows:

Explain what these projects are all about:

Easyframework-model: Data model, entity classes corresponding to database table fields

Easyframework-core: Core business Projects. Primarily service processing business logic

Easyframework-persist: Data persistence layer, operation low-level database.

Easyframework-utils: Tool class, all tool classes are extracted and written in this project.

Easyframework-web: This is the web layer of the entire project, the display of the page and the control layer

Note: When creating these projects, only Easyframework-web is the Web project that maven: Maven-archetype-webapp, and the others are Java projects: Maven-archetype-quicktart

Open the Easyframework-root pom.xml file and you will see that the modularity is like this:

Next is to configure the dependencies of each module, I personally think that the project is so dependent, do not know right, hehe ....

For example Easyframework-web this project relies on Easyframework-core (business core) and Easyframework-model (entity Class), Easyframework-utils (Common tool Class) this three modules.

Then how in the Easyframework-web of the pom.xml embodiment, the specific following:

Open the project's Maven dependency and you'll find that you've relied on these three projects

But you should feel strange, why there are so jar package, obviously only refer to these three projects, which came from so many jar package.

You will find that I pom.xml the file again, there is a parent node that inherits the root node of the Pom, which is the project inheritance dependency of Maven, which inherits some values from the parent pom. This is necessary to build a large system.

That way you don't need to add the same dependency element over and over again, of course, if you have the same dependency in the subproject, the value in the parent Pom will be overwritten.

[Go] Build multi-module enterprise project

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.