Using MAVEN to merge Web projects

Source: Internet
Author: User

As MAVEN management projects become more prevalent, the biggest benefit of MAVEN is the centralized management of the warehouse that relies on packages, and Maven can use inheritance and aggregation.

1.Maven multi-module project.

The MAVEN multi-module project requires a parent project to aggregate other modules, which is the Pom.xml file:

< Modules > < Module > Module 1</module><module> Module 2 </ Module > </ Modules >      

Then in the Submodule, declare the parent project, and the code in the Submodule is as follows:

<Parent>    <groupId>GroupID of the Parent project</groupId>    <Artifactid>Artifactid of the Parent project</Artifactid>    <version>Version number</version>    <RelativePath>.. /..</RelativePath></Parent>

2.Maven merge multiple Web projects.

MAVEN's multi-module Maven-war-plugin plugin overlays property to handle the pom.xml of the project:

<Build>    <Finalname>Project Publication name</Finalname>    <Pulgins>     <Pulgin>     <groupId>Org.apache.maven.plugins</groupId>    <Artifactid>Maven-war-plugin</Artifactid>     <Configuration>     <Packagingexcludes>    <Overlays>     <Overlay>       <groupId>Web1</groupId>     <Artifactid></Artifactid>    </Overlay>   <Overlay>       <groupId>Web2</groupId>     <Artifactid></Artifactid>    </Overlay>   <Overlay>       <groupId>Web3</groupId>     <Artifactid></Artifactid>    </Overlay>   </Overlays>    </Packginexcludes>    </Configuration>    </Pulgin>    </Pulgins>          <Resources>            <Resource>                       <Directory>Brutishness</Directory>                 <excludes>                        <Exclude>config/**</Exclude>                    </excludes>                </Resource>            <Resource>                <Directory>Src/main/resources</Directory>            </Resource>        </Resources>         </Build>        

Attentive users will find that, in fact, this is completely the same as our original construction, deployment, yes, MAVEN is not so complicated, m2eclipse maven plugin has helped us do a lot of things, Maven will only make the migration between our projects more convenient, more concise, That's one of the big reasons I like maven.

I am an absolute maven novice, the above article with only Maven's fur just, Maven more build function also need to go into the research, the above article just want to tell those who want to try Maven novice, in fact, maven not only to the code management brought great convenience, And we can not change our original development habits completely. So, embrace maven!

Using MAVEN to merge Web projects

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.