转+总结!! maven的package与install命令区别
如果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命令区别的更多相关文章
- maven之package与install的区别
mvn clean package 先看命令的执行过程 mvn clean install 同样先看执行过程 mvn clean package依次执行了clean.resources.compile ...
- maven中package和install命令的区别
mvn package 编译并打包工程,根据pom文件中packaging是jar还是war进行打包,会在项目的target目录下生成一个jar/war包. mvn install 打包并安装到mav ...
- maven之clean、install命令
1.进入到maven根目录,执行mvn compile命令会在根目录生成target文件(参照maven之helloworld案例),如下图: 2.执行mvn clean可将根目录下生成的target ...
- (转)理解maven命令package、install、deploy的联系与区别
我们在用maven构建java项目时,最常用的打包命令有mvn package.mvn install.deploy,这三个命令都可完成打jar包或war(当然也可以是其它形式的包)的功能,但这三个命 ...
- 理解maven命令package、install、deploy的联系与区别
我们在用maven构建java项目时,最常用的打包命令有mvn package.mvn install.deploy,这三个命令都可完成打jar包或war(当然也可以是其它形式的包)的功能,但这三个命 ...
- maven package,clean,install,compile命令
1.Ideal中显示 2.各个阶段干嘛的? compile,编译命令,会在项目路径下生成一个target目录,在该目录中包含一个classes文件夹,里面全是生成的class文件及字节码文件 pack ...
- maven命令package、install、deploy比较
maven生命周期(lifecycle)由各个阶段组成,每个阶段由maven的插件plugin来执行完成.生命周期(lifecycle)主要包括clean.resources.complie.inst ...
- 【maven】maven命令 package、install、deploy 的区别
maven命令 package.install.deploy 的区别
- idea工具maven生命周期clean,install,package等区别
idea工具maven projects里面有9种生命周期,生命周期是包含在一个项目构建中的一系列有序的阶段. 一.最常用的两种打包方法: 1.clean,package(如果报错,很可能就是jar依 ...
随机推荐
- 多线程-Fork/Join
Fork/Join Java7提供了Fork/Join来支持将一个任务拆分成多个“小任务”并行计算,再把多个“小任务”的结果合并成总的计算结果. 类图 Java7提供了ForkJoinPool来支持将 ...
- Atitit.遍历图像像素点rgb java attilax总结
Atitit.遍历图像像素点rgb java attilax总结 1. 遍历像素点 1 2. 提取一行 1 3. Rgb分量提取 2 4. 其他读取像素 3 5. --code 5 6. 参考 6 1 ...
- 为什么 Objective-C 很难
转自:http://www.oschina.net/question/213217_41058 作为一个Objective-C的coder,我总能听到一部分人在这门语言上抱怨有很多问题.他们总在想快速 ...
- jQuery中的text(),html(),val()有什么区别
text():获取或者改变指定元素的文本html():获取或改变指定元素的html元素以及文本val():获取或者改变指定元素的value值(一般是表单元素) 以上3个都是jquery类库中的语法 第 ...
- iOS开发多线程篇 08 —GCD的常见用法
iOS开发多线程篇—GCD的常见用法 一.延迟执行 1.介绍 iOS常见的延时执行有2种方式 (1)调用NSObject的方法 [self performSelector:@selector(run) ...
- 解决eclipse偶尔无视breakpoint的行为
一般是如果你使用了T[]这样的参数列表,也就是generic array作为参数,你就算给函数打了断点,有时也会被eclipse无视 比如如下代码,你在调试main的时候,eclipse就会把doPa ...
- CSRF学习笔记之CSRF的攻击与防御以及审计【00x1 】
+++++++++++++++++++++++++++ + 00x1 实现简单的攻击 + 00x2 代码审计漏洞的源头 +++++++++++++++++++++++++++ 00x1 简单的csrf ...
- JSON简述
JSON(JavaScript Object Notation) JavaScript 对象表示法,是一种轻量级的数据交换格式.类似于XML. 基础结构 JSON基于两种结构(即由两种结构组成:对象( ...
- Squares - poj 2002(hash)
枚举两个点作为一条边,求出正方形的另外两个点,利用hash查找另外两个点. #include<stdio.h> #include<string.h> #include<s ...
- C++ STL标准模板库(queue)
//queue的使用 #define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<queue> using name ...