博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Maven 初学(一)基本概念
阅读量:6484 次
发布时间:2019-06-23

本文共 3488 字,大约阅读时间需要 11 分钟。

Pom中有三个主要元素

Groupid,artifactid,version

goupid 是一个组织唯一的标识  例如 com.ibm.www

artifactid  是一个工程呢ID        ibm-project

version   代表一个版本  例如    com.ibm.www.ibm-project.1.0

 

maven执行一个目标(goal)有以下几个步骤

prepare-resources    资源的拷贝

compile   源代码拷贝阶段

package  创建jar/war包阶段

install      安装包到本地或者远程库中

mvn clean dependency:copy-dependencies package
 
clean 首先被执行,
然后dependency:copy-dependencies被执行
然后是package被执行
clean 的 Lifecycle
pre-clean
clean
post-clean
 
默认 build Lifecycle
validate    验证工程是否正确,所有必要的信息是否有效
 
Lifecycle Phase Description
validate Validates whether project is correct and all necessary information is available to complete the build process.
initialize Initializes build state, for example set properties
generate-sources Generate any source code to be included in compilation phase.
process-sources Process the source code, for example, filter any value.
generate-resources Generate resources to be included in the package.
process-resources Copy and process the resources into the destination directory, ready for packaging phase.
compile Compile the source code of the project.
process-classes Post-process the generated files from compilation, for example to do bytecode enhancement/optimization on Java classes.
generate-test-sources Generate any test source code to be included in compilation phase.
process-test-sources Process the test source code, for example, filter any values.
test-compile Compile the test source code into the test destination directory.
process-test-classes Process the generated files from test code file compilation.
test Run tests using a suitable unit testing framework(Junit is one).
prepare-package Perform any operations necessary to prepare a package before the actual packaging.
package Take the compiled code and package it in its distributable format, such as a JAR, WAR, or EAR file.
pre-integration-test Perform actions required before integration tests are executed. For example, 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. For example, cleaning up the environment.
verify Run any check-ups to verify the package is valid and meets quality criterias.
install Install the package into the local repository, which can be used as a dependency in other projects locally.
deploy Copies the final package to the remote repository for sharing with other developers and projects.

 

local Repository 本地库

可以在settings文件中设置本地库位置

C:/MyLocalRepository

Central Repository  中心库

maven在本地库中不能找到依赖的时候,就回去中心库中寻找

Remote Repository远程库

4.0.0
com.companyname.projectgroup
project
1.0
com.companyname.common-lib
common-lib
1.0.0
companyname.lib1
http://download.companyname.org/maven2/lib1
companyname.lib2
http://download.companyname.org/maven2/lib2

使用archetype插件创建工程

C:\MVN>mvn archetype:generate-DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

 参考自:

 

 

 

 

 

 

转载于:https://www.cnblogs.com/mengjianzhou/p/5986830.html

你可能感兴趣的文章
分享一个shell脚本:通过Jumper机器来创建Jumper和target机器账号
查看>>
UITableViewCell分割线不是左对齐的问题
查看>>
CentOS7 编译安装PHP7
查看>>
MySQL常见错误代码及代码说明
查看>>
Cglib动态代理基础使用
查看>>
技术人员,为什么会苦逼
查看>>
使用126邮箱发送邮件的python脚本
查看>>
Maven
查看>>
缓存系统在游戏业务中的特异性
查看>>
redis的基本数据类型
查看>>
.NET 同步与异步之锁(Lock、Monitor)(七)
查看>>
前端大牛们都学过哪些?
查看>>
在iOS当中发送电子邮件和短信
查看>>
13~1003的和
查看>>
pycharm如何新项目如何不默认创建虚拟环境(吐槽)
查看>>
Loadrunner检查点小结(很经典)
查看>>
MySQL字段类型详解
查看>>
ORACLE 的游标
查看>>
虚拟机安装的UBUNTU全屏的方法:
查看>>
java虚拟机类加载器
查看>>