zoukankan      html  css  js  c++  java
  • 转+总结!! maven的package与install命令区别

    如果b项目依赖a项目,而a打了包(package),jar仅仅时打到了a项目的target下。这时编译b项目,还是会报错,找不到所依赖的a项目,说明b项目在本地仓库是没有找到它所依赖的a项目。

    然后,我install a项目这时,有以下日志,[INFO] Installing G:projectsa argeta-0.0.1-SNAPSHOT.jar to F: epositorycomchenjuna.0.1-SNAPSHOTa-0.0.1-SNAPSHOT.jar
    [INFO] Installing G:projectsapom.xml to F: epositorycomchenjuna.0.1-SNAPSHOTa-0.0.1-SNAPSHOT.pom,

    说明a项目已安装到本地仓库了,并且是jar和pom同时安装的.

    这时候去compile b项目,编译通过.

    总之,package是把jar打到本项目的target下,而install时把target下的jar安装到本地仓库,供其他项目使用.

    (-----以上转自:http://blog.csdn.net/bawcwchen/article/details/46957627)

    maven常用命令

    package:负责打包项目到本项目target路径下(take the compiled code and package it in its distributable format, such as a Jar/War/Ear.)

    clean:清除target目录的文件

    install:生成jar包并安装到本地maven仓库(xx/.m2/xx),可供其他项目调用(install the package into the local repository, for use as a dependency in other projects locally)

    compile:编译项目(compile the source code of the project)

    test:执行测试代码(test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed)

    平时打包要发布的项目(指定环境dev/test/prod):mvn clean package -Dmaven.test.skip=true -Pprod 

    -P xxx 会激活项目下的pom.xml配置的<profiles>标签下id为xxx 的相关配置

    Maven Phases

    Although hardly a comprehensive list, these are the most common default lifecycle phases executed.

    • validate: validate the project is correct and all necessary information is available
    • compile: compile the source code of the project
    • test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
    • package: take the compiled code and package it in its distributable format, such as a JAR.
    • integration-test: process and deploy the package if necessary into an environment where integration tests can be run
    • 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.

    There are two other Maven lifecycles of note beyond the default list above. They are

    • clean: cleans up artifacts created by prior builds
    • site: generates site documentation for this project
  • 相关阅读:
    DevExpress ASP.NET v19.1版本亮点:Pivot Grid等控件
    .NET界面控件DevExpress全新发布v19.1.5|改进Office 2019主题
    Kendo UI for jQuery使用教程:操作系统/jQuery支持等
    Web安全篇之SQL注入攻击
    SQL Server中timestamp(时间戳)和rowversion(版本戳)
    PyCharm2019 激活码
    性能测试 vs 负载测试 vs 压力测试
    一套完整的压力测试项目文档
    Visual Studio性能计数器,负载测试结果分析- Part III
    Visual Studio进行负载测试,RIG和负载测试术语- Part II
  • 原文地址:https://www.cnblogs.com/wuyun-blog/p/7521201.html
Copyright © 2011-2022 走看看