MAVEN creates a multiple-module project (horizontal and tree-structured)

Source: Internet
Author: User

Haven't written a blog for a long time, a lot of things are in the notes, not sorted. Do not like to write without their own digestion and collation of knowledge, if they do not understand, it is still not to write good, lest mislead other students.

The main thing to write this time is to use MAVEN to create a multiple-module Web project, a SSM-integrated blog before, and a Web project created by Maven, where the Web/dao/service layer uses package to isolate, and enterprise-level development generally does not. We will divide the modules of different functions using the module in Maven, so that each module can play a jar package or a war package on its own, or it can be provided.

Maven can create a multiple-module project with two structures, one horizontal and one tree, and look at the following figure to see how they differ:



The storm project is the tree structure, and the winter project is the horizontal structure, then what is the difference between them? In fact, in the creation process, there is no difference, that is, the path of module can be modified to each other. However, as far as experience is concerned, the individual feels that the level is better and looks more comfortable. Here is how to create such a project, read it will find the process is very simple, know that this model is open a thought, not how difficult.


This experimental environment:

Idea14

JDK7

maven3.2.1


Specific steps:

1. First create a parent project

File->new-->project, select Maven, build one of the most common MAVEN projects, generate SRC as needed to keep, I am here to erase. Note: After the creation, you need to check the Pom.xml, modify the <packaging> tag inside the value of POM


2, right key to create a good winter parent project-->new-->module-->maven, the creation process here is similar to the above, but you can use the archetype of Maven to create, This creates a basic MAVEN project structure that facilitates rapid access to development. (about this archetype I will write another blog to say, when the creation of the pit ... Sometimes it is stuck in a place because of the speed problem ... There's no more chatter here. )


The following diagram creates the path that needs to be noted, and this is the key to the multi-module MAVEN project structure. If the default address is used here, then the tree-structured project is generated, and if the address is modified, the module module and the winter module are horizontally structured on the first level of the directory.

Tree-shaped structure:

/winter

/winter/winter.biz

/winter/winter.dal

Horizontal structure:

/winter

/winter.biz

/winter.dal


3, according to their own needs and project structure, create the definition of the module bar ....


Advantages:

A, module isolation clear

b, different modules can be packaged separately, flexible deployment

C, as the project becomes larger, this way to expand the better

Disadvantages:

If the structure of the module responsibility is not clear, then not only the development costs rise (compared to a single project, this type of switch between different modules and find code will be troublesome point), and there is no corresponding advantages.


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.