maven 简记

1.maven 坐标:用于唯一标识每一个java构件,元素包括groupId、artifactId、version、packaging、classfier。

 groupId

实际项目

 

artifactId

实际模块

 

version

构件的版本

版本号定义约定: <主版本>.<次版本>.<增量版本>-<里程碑版本>

packaging

打包方式

jar(默认)、warpommaven-plugin等.

classfier

附属构件(如javadocsources)

 


2.依赖

 

坐标

基本要素groupId、artifactId和version

 

type

依赖的类型

 

scope

与编译classpath、测试classpath、运行classpath)的关系

下面,英文文档

optional

依赖是否可选

 

exclusions

排除传递性依赖

 

 

Scope范围

a.compile
This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects.

b.provided
This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive.

c.runtime
This scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath.

d.test
This scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases. This scope is not transitive.

e.system
This scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository.

f.import (only available in Maven 2.0.9 or later)
This scope is only supported on a dependency of type pom in the <dependencyManagement> section. It indicates the dependency to be replaced with the effective list of dependencies in the specified POM's <dependencyManagement> section. Since they are replaced, dependencies with a scope of import do not actually participate in limiting the transitivity of a dependency.

 

3.maven仓库

         本地仓库 和 远程仓库 (中央仓库、私服)

4.maven 三套独立的生命周期:cleandefault 和 site

Clean Lifecycle

pre-clean

execute processes needed prior to the actual project cleaning

clean

remove all files generated by the previous build

post-clean

execute processes needed to finalize the project cleaning

Default Lifecycle

validate

validate the project is correct and all necessary information is available.

initialize

initialize build state, e.g. set properties or create directories.

generate-sources

generate any source code for inclusion in compilation.

process-sources

process the source code, for example to filter any values.

generate-resources

generate resources for inclusion in the package.

process-resources

copy and process the resources into the destination directory, ready for packaging.

compile

compile the source code of the project.

process-classes

post-process the generated files from compilation, for example to do bytecode enhancement on Java classes.

generate-test-sources

generate any test source code for inclusion in compilation.

process-test-sources

process the test source code, for example to filter any values.

generate-test-resources

create resources for testing.

process-test-resources

copy and process the resources into the test destination directory.

test-compile

compile the test source code into the test destination directory

process-test-classes

post-process the generated files from test compilation, for example to do bytecode enhancement on Java classes. For Maven 2.0.5 and above.

test

run tests using a suitable unit testing framework. These tests should not require the code be packaged or deployed.

prepare-package

perform any operations necessary to prepare a package before the actual packaging. This often results in an unpacked, processed version of the package. (Maven 2.1 and above)

package

take the compiled code and package it in its distributable format, such as a JAR.

pre-integration-test

perform actions required before integration tests are executed. This may involve things such as setting up the required environment.

integration-test

process and deploy the package if necessary into an environment where integration tests can be run.

post-integration-test

perform actions required after integration tests have been executed. This may including cleaning up the environment.

verify

run any checks to verify the package is valid and meets quality criteria.

install

install the package into the local repository, for use as a dependency in other projects locally.

deploy

done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

Site Lifecycle

pre-site

execute processes needed prior to the actual project site generation

site

generate the project's site documentation

post-site

execute processes needed to finalize the site generation, and to prepare for site deployment

site-deploy

deploy the generated site documentation to the specified web server

5.聚合和继承 packaging      ->       pom

  各个maven项目对于超级pom

6.插件  maven-插件名-plugin

      命令 mvn:插件名:goal

goal 关联  maven生命周期的phase

个别详细参见:http://blog.csdn.net/zjf280441589/article/details/53044308

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值