maven学习

Maven 特性

  1. 最好的项目实践——在几秒钟内创建一个项目或者模块
  2. 始终一致的访问所有项目——意味着开发人员不在为项目准备而担忧
  3. 高级依赖管理,包括自动更新、依赖闭包(也可以说是传递依赖)
  4. 可以同时处理多个项目
  5. 一个不断增长的仓库,元数据库,并且可以直接使用,以实时提供最新版本的方式。
  6. 扩展,可以通过java或者其他脚本语言扩展插件
  7. 只需要少量或不需要额外配置即可访问新功能
  8. 用于依赖管理和maven外部部署的ant任务
  9. 基于模块构建:Maven可以构建任意数量的项目,如JAR,WAR或者发行版,并且大多数情况下不需要编写任何脚本
  10. Coherent site of project information: Using the same metadata as for the build process, Maven is able to generate a web site or PDF including any documentation you care to add, and adds to that standard reports about the state of development of the project. Examples of this information can be seen at the bottom of the left-hand navigation of this site under the "Project Information" and "Project Reports" submenus.
  11. Release management and distribution publication: Without much additional configuration, Maven will integrate with your source control system (such as Subversion or Git) and manage the release of a project based on a certain tag. It can also publish this to a distribution location for use by other projects. Maven is able to publish individual outputs such as a JAR, an archive including other dependencies and documentation, or as a source distribution.
  12. Dependency management: Maven encourages the use of a central repository of JARs and other dependencies. Maven comes with a mechanism that your project's clients can use to download any JARs required for building your project from a central JAR repository much like Perl's CPAN. This allows users of Maven to reuse JARs across projects and encourages communication between projects to ensure that backward compatibility issues are dealt with.

Maven的使用

安装

运行

maven允许使用这样的语法 

 1.mvn [options] [<goal(s)>][<phase(s)>]

所有可以操作的命令可以通过下面这个命令访问

1.mvn -h

 构建maven项目典型使用例如

mvn package

构建生命周期与它们的阶段顺序是:

  • clean——pre-clean,clean,post-clean
  • default——validate(校验),initialize(初始化),generate-sources(生成源码),process-sources(处理源码), generate-resources(生成项目源文件),compile(编译),process-classes(处理class), generate-test-sources(生成-测试-源码), process-test-sources(处理-测试-源码), generate-test-resources(), process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test(集成测试前), integration-test, post-integration-test, verify(验证), install, deploy(部署)
  • site——pre-site,site,post-site,site-deploy

生成所有包与文档文件可以以下命令构建

mvn clean deploy site-deploy

只是创建包与安装到本地可以通过以下命令

mvn verify

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值