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 ...
随机推荐
- achartengine 绘图表神器
http://code.google.com/p/achartengine/
- centOS下安装node4.x
在以前 Node 0.x 的时候,只需要通过 yum install -y nodejs 就可以把 Node 安装好了.但是 yum 安装的 Node 只能安装到 0.10.40 版的,并不能安装到 ...
- Hark的数据结构与算法练习之若领图排序ProxymapSort
算法说明 若领图排序是分布排序的一种. 个人理解,若领图排序算是桶排序+计数排序的变异版,桶排序计数排序理解了,那么若领图排序理解起来就会比较容易.区别其实就是存储中间值的方式做了调整…… 话说,这个 ...
- HyperLink控件
设置链接 NavigateUrl 填写链接 text 属性 为显示内容
- http://jingyan.baidu.com/article/d169e186aa8728436611d8f3.html
http://jingyan.baidu.com/article/d169e186aa8728436611d8f3.html
- EntityFramework 6.0< Code First > 连接 Mysql数据库
网上有很多关于用EntityFrame来连接Mysql数据库的教程,可是很多并不靠谱,转载的太多了.找了很久,总算是配置好了,现在分享一下. 一,安装: 1.开发环境: VS2013与EF6 ...
- 算法教程(1)zz
Introduction Many TopCoders seem to be mortally afraid of geometry problems. I think it's safe to sa ...
- Sky数[HDU2097]
Sky数 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- 【BZOJ】1179: [Apio2009]Atm(tarjan+spfa)
http://www.lydsy.com/JudgeOnline/problem.php?id=1179 缩点建图... #include <cstdio> #include <cs ...
- 【wikioi】1403 新三国争霸(dp+kruskal)
http://wikioi.com/problem/1403/ 一开始的确感觉和bzoj1003很像,不同的是这里还要求联通,求最小的边. 我们可以想到用最小生成树(为嘛我自己想不到呢..) 我们可以 ...