maven--composer---setting.xml(updatepolicy)---mvn install , mvn deploy
场景:
最近再整系统的自动部署流程,由于公司的jar包在svn以及mvn的仓库上都存在,开发人员在开发的过程中都依赖mvn仓库中的Jar
包,在jar上线的时候,配置管理人员把jar 从svn管理的工作目录直接commit到svn的仓库中,同时也执行mvn
deploy命令,把该Jar包deploy 的mvn仓库中。
由于每次执行mvn
deploy的时候,mvn会重新打jar,而在打出的jar包中的META-INF目录下包括一个pom.properties文件,该文件记录的是打
成该jar包的时间,这样导致每次执行mvn
deploy的时候,这个时间都不同,当进行MD5比较的时候,虽然class没有任何变化,但是由于该文件的变化,而导致对同样的代码mvn
deploy成的Jar的md5值不一样
解决办法:
当用mvn install 打出jar 包后,如果需要把该jar原封不动的deploy到mvn仓库中,可以执行如下命令:
mvn deploy:deploy-file -Durl=url -DrepositoryId=repositoryId -Dfile=file -DpomFile=pom.xml -Dversion=1.0
-Durl 是指要deploy到仓库的路径
-DrepositoryId jar 包的repositoryid
-Dfile jar包的具体路径
-DpomFile jar对应的pom路径
-Dversion jar的版本
其实在官网上写的很清楚,如需要查看更加详细的用法,请见官网:
http://maven.apache.org/plugins/maven-deploy-plugin/usage.html
--checkstyle-http://blog.csdn.net/kongxx/article/details/7750015
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.10</version> <executions> <execution> <id>checkstyle</id> <phase>validate</phase> <goals> <goal>check</goal> </goals> <configuration> <failOnViolation>true</failOnViolation> </configuration> </execution> </executions> </plugin>
--------jenkins mvn
http://www.cnblogs.com/zhangchuan210/p/3413811.html
<build>
<directory>target</directory>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<outputDirectory>build</outputDirectory>
<testOutputDirectory>build/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</build>
Look in your settings.xml
(or, possibly your project's parent or corporate parent POM) for the <repositories>
element. It will look something like the below.
<repositories>
<repository>
<id>central</id>
<url>http://gotoNexus</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</releases>
</repository>
</repositories>
Note the <updatePolicy>
element. The example tells Maven to contact the remote repo (Nexus in my case, Maven Central if you're not using your own remote repo) any time Maven needs to retrieve a snapshot artifact during a build, checking to see if there's a newer copy. The metadata is required for this. If there is a newer copy Maven downloads it to your local repo.
In the example, for releases, the policy is daily
so it will check during your first build of the day. never
is also a valid option, as described in Maven settings docs.
Plugins are resolved separately. You may have repositories configured for those as well, with different update policies if desired.
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://gotoNexus</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
Someone else mentioned the -o
option. If you use that, Maven runs in "offline" mode. It knows it has a local repo only, and it won't contact the remote repo to refresh the artifacts no matter what update policies you use.
maven--composer---setting.xml(updatepolicy)---mvn install , mvn deploy的更多相关文章
- Maven配置文件setting.xml详解
注:本文来源于:大话JAVA的那些事 <Maven配置文件setting.xml详解> <?xml version="1.0" encoding="UT ...
- Maven学习笔记—私服(包含maven的setting.xml配置)
为什么要用远程仓库(私服) 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的maven仓库下载到本地,而一个团队中的所有人都重复的从maven仓库下载构件,这样就加大了中央仓库 ...
- maven的setting.xml文件中只配置本地仓库路径的方法
maven的setting.xml文件中只配置本地仓库路径的方法 即:settings标签下只有一个 localRepository标签,其他全部注释掉即可 <?xml version=&quo ...
- Maven之setting.xml配置文件详解
setting.xml配置文件 maven的配置文件settings.xml存在于两个地方: 1.安装的地方:${M2_HOME}/conf/settings.xml 2.用户的目录:${user.h ...
- Maven可用setting.xml
最简单的可用阿里镜像配置 <?xml version="1.0" encoding="UTF-8"?> <settings> <l ...
- 【maven】 maven的setting.xml文件的详解
1 Maven的安装 安装Maven之前要确保已经安装好了jdk,并且配置好了环境变量JAVA_HOME.具体安装步骤如下: 从apache网上下载maven项目的压缩包.下载地址为:ht ...
- Maven 的setting.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Soft ...
- maven配置文件setting.xml字段注释
maven的配置文件为settings.xml,在下面路径中可以找到这个文件,分别为: $M2_HOME/conf/settings.xml:全局设置,在maven的安装目录下: ${user.hom ...
- Maven系列--setting.xml 配置详解
文件存放位置 全局配置: ${M2_HOME}/conf/settings.xml 用户配置: ${user.home}/.m2/settings.xml note:用户配置优先于全局配置.${use ...
随机推荐
- 逆序数 POJ 2299 Ultra-QuickSort
题目传送门 /* 题意:就是要求冒泡排序的交换次数. 逆序数:在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序. 一个排列中逆序的总数就称为这个排列的逆 ...
- Task 实现多线程的模板
1.Task多线程简单模板 using System; using System.Collections.Generic; using System.Threading.Tasks; ...
- Revit二次开发示例:HelloRevit
本示例实现Revit和Revit打开的文件的相关信息. #region Namespaces using System; using System.Collections.Generic; using ...
- Unity3D安装多版本
今天我也遇到这个版本更换问题. 老外也遇到了的!哈哈. 错误提示是: Fatal error!type = =kMetaAssetType & pathName.find("lib ...
- BZOJ3853 : GCD Array
1 n d v相当于给$a[x]+=v[\gcd(x,n)=d]$ \[\begin{eqnarray*}&&v[\gcd(x,n)=d]\\&=&v[\gcd(\fr ...
- NodeJS中form上传附件中针对表单的multiple attribute出现的问题总结
在express中上传附件需要在表单中添加enctype="multipart/form-data"属性,并且在新的4.0.1版本中需要手动添加中间件app.use(connect ...
- [ZT] Vim快捷键分类
一. 移动: h,j,k,l: 左,下,上,右. w: 下一个词的词首. e:下一个词的词尾. b:上一个词的词首. <>: v 模式选中后进行缩进.二. 跳 ...
- Medical Image Processing Conference and Journal 医学图像处理会议与期刊
会议: Information Processing in Medical Imaging,IPMI IPMI2013 International Conference on Medical Imag ...
- javascript中的function
function / 对象 所有的变量和方法名的:以字母,$ _开头其他随便,尽量使用英文字母命名,见名知意注意点:不允许使用关键字定义变量和方法的名称====函数即方法,方法即函数====百度:ja ...
- 新建childTest文件夹,里面依然放进我们需要的.py文件即可
一.模块 我们编写文件:a.py,放在C:\Python34\Lib\sit-packages下,里面写上一句代码为: print('this is a') 之后我们就可以在我们的代码里面引用a.py ...