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

然后,我install a项目这时,有以下日志,[INFO] Installing G:\projects\a\target\a-0.0.1-SNAPSHOT.jar to F:\repository\com\chenjun\a\0.0.1-SNAPSHOT\a-0.0.1-SNAPSHOT.jar
[INFO] Installing G:\projects\a\pom.xml to F:\repository\com\chenjun\a\0.0.1-SNAPSHOT\a-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

转+总结!! maven的package与install命令区别的更多相关文章

  1. maven之package与install的区别

    mvn clean package 先看命令的执行过程 mvn clean install 同样先看执行过程 mvn clean package依次执行了clean.resources.compile ...

  2. maven中package和install命令的区别

    mvn package 编译并打包工程,根据pom文件中packaging是jar还是war进行打包,会在项目的target目录下生成一个jar/war包. mvn install 打包并安装到mav ...

  3. maven之clean、install命令

    1.进入到maven根目录,执行mvn compile命令会在根目录生成target文件(参照maven之helloworld案例),如下图: 2.执行mvn clean可将根目录下生成的target ...

  4. (转)理解maven命令package、install、deploy的联系与区别

    我们在用maven构建java项目时,最常用的打包命令有mvn package.mvn install.deploy,这三个命令都可完成打jar包或war(当然也可以是其它形式的包)的功能,但这三个命 ...

  5. 理解maven命令package、install、deploy的联系与区别

    我们在用maven构建java项目时,最常用的打包命令有mvn package.mvn install.deploy,这三个命令都可完成打jar包或war(当然也可以是其它形式的包)的功能,但这三个命 ...

  6. maven package,clean,install,compile命令

    1.Ideal中显示 2.各个阶段干嘛的? compile,编译命令,会在项目路径下生成一个target目录,在该目录中包含一个classes文件夹,里面全是生成的class文件及字节码文件 pack ...

  7. maven命令package、install、deploy比较

    maven生命周期(lifecycle)由各个阶段组成,每个阶段由maven的插件plugin来执行完成.生命周期(lifecycle)主要包括clean.resources.complie.inst ...

  8. 【maven】maven命令 package、install、deploy 的区别

    maven命令  package.install.deploy  的区别

  9. idea工具maven生命周期clean,install,package等区别

    idea工具maven projects里面有9种生命周期,生命周期是包含在一个项目构建中的一系列有序的阶段. 一.最常用的两种打包方法: 1.clean,package(如果报错,很可能就是jar依 ...

随机推荐

  1. Ubuntu 的 apt-get 代理设置(zhuan)

    url: http://qixinglu.com/post/ubuntu_apt-get_proxy_setup.html 升级到 Ubuntu10.04 后,发现 apt-get 的代理设置有改变了 ...

  2. 使用struts的时候form用struts的,不用html本身的

    同样的struts-config.xml, web.xml的配置,使用2个版本的form,只有struts的form才能成功运行 使用html版本的form导致post的路径不对,报404 HTML版 ...

  3. linux2.4中netfilter_nat_alg机制分析--以FTP流程为例,分析NAT和ALG

    以FTP流程为例,分析NAT和ALG 网络环境: ×5+6=1286) 创建×5+6=1286),更新skb的应用层信息(这里应用层信息还是×5+6=1286) 创建×5+6=1286) 创建×5+6 ...

  4. pipe_wait问题_转

    转自:调用Process.waitfor导致的进程挂起 最近遇到pipe_wait问题,父进程调用子进程时,子进程阻塞,cat /proc/$child/wchan输出pipe_wait,进程阻塞在p ...

  5. TCP/IP各层协议数据格式

    ISO规范里定义了7层网络模型,实际常用的仍为TCPIP四层网络模型. 注:本文章插图均来自<图解TCP/IP>. 数据链路层帧格式 经常说的帧格式为以太网帧格式,由于类型和帧长度字段不重 ...

  6. Linux上安装Nginx及常用命令

    一.Linux安装软件常用方法 1.rpm(或pkg)安装,类似于Windows安装程序,是预编译好的程序. 1)使用的是通用参数编译,配置参数不是最佳 2)可控制性不强,比如对程序特定组件的定制性安 ...

  7. cocos2dx3.1 win7安装步骤及编译到安桌

    1. 下载及安装好工具 python2.7  ndk sdk ant cocos2dx3.1 eclipse 这些工具和曾经一样下载好放到同一文件夹下 加入环境变量 将python2.7的安装路径加入 ...

  8. 大数据(9) - Flume的安装与使用

    Flume简介 --(实时抽取数据的工具) 1) Flume提供一个分布式的,可靠的,对大数据量的日志进行高效收集.聚集.移动的服务,Flume只能在Unix环境下运行. 2) Flume基于流式架构 ...

  9. gibhub上搭建个人静态网站介绍

    之前学习过git的基本命令.今天介绍一下github上搭建个人网站的步骤. 在window系统上搭建gibhub个人网站(只能执行html.css和js文件),这就是纯静态页面. 步骤一:注册gith ...

  10. 好久没写blog了 ~ 换了个城市,换了个公司,各种忙碌

    最近一直在忙工作交接以及换城市.入职的事情 ~~~ 新公司做C++的比较少,so全上C++11了,写代码各种爽. 最近应该会写一点关于QT的blog , 学到新知识了哈.