Maven-key notes, maven-Key Points

Source: Internet
Author: User

Maven-key notes, maven-Key Points
-- Maven notes


1. maven command


2. archetype Plugin: used to create a directory skeleton that complies with maven requirements
Command: mvn archetype: generate


3.
Coordinates: Component
Repository: local repository and remote Repository
Image repository: http://maven.net.cn/content/groups/public
Change the location of the local repository


4. maven lifecycle:
Clean Project
Pre-clean
Clean clears the last build-generated file
Post-clean


Default build project (CORE)
Compile test package install


Site generation project site
Pre-site: the work to be done before the project site is generated
Site: generate the site file of the project
Post-site
Site-deploy


5. Some plug-ins provided by maven


6. pox. xml parsing:
Set whether dependency is optional
<Optional>

Exclude dependency transfer list
<Exclusions> <exclusion>


Dependency Management
<Dependencies> <dependency>


Plug-ins
<Build> <plugins> <plugin>

Child module inherits parent Module
<Parent>

Module
<Modules> <module>

Dependency scope: -- parameter (compile (default) \ provided (valid for compilation and test) \ runtime (test, run) \ test (test) \ system (compilation, test, portable difference) \ import (import range, only used in dependencyManagement, indicating to import dependency configuration from other pom ))
<Scope>


Dependency transmission:



Dependency conflict:
Principles:
Short Circuit priority,
First declare first priority (same path length)

7. Aggregation and inheritance
Aggregation (modules module tag)
Inheritance
For example:
-- Parent class pom:
<Properties>
<Junit. version> 4.0.0 </junit. version>
</Properties>


<DependencyManagement>
<Dependencies>
<Dependency>
<GroupId> junit </groupId>
<ArtifactId> junit </artifactId>
<Version >$ {junit. version} </version>
</Dependency>
<Dependencies>


</DependencyManagement>


-- Subclass pom:
<Parent>
Parent pom Coordinate
</Parent>


8. maven uses Jetty and tomcat services to run web projects









Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.