回顾:maven配置和常用命令整理
- 推荐两个库地址,开源中国的好像不好使了
阿里的仓库:http://maven.aliyun.com/nexus/content/groups/public/
另一个:http://repo2.maven.org/maven2/
2.打包
- maven-compile-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>这个插件可以指定jdk版本和字符集,防止编译时乱码
- maven-surefire-plugin
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<skip>true</skip>
<argLine>-Dfile.encoding=UTF-8</argLine>
</configuration>
</plugin>可以跳过测试,事实上还可以用include和exclude指定包括哪些测试以及不运行哪些测试,如果测试中有乱码可以指定字符集
- maven-assembly-plugin
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<finalName>tcp</finalName>
<appendAssemblyId>false</appendAssemblyId>
<encoding>utf-8</encoding>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>就是能将各个包单独打到指定目录的工具,详见:
- maven-shade-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>将各个依赖包都打入工程包,生成单独可执行jar
- build resources
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<targetPath>${project.build.directory}/classes</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**</include>
</includes>
<targetPath>${project.build.directory}/classes</targetPath>
</resource>
</resources>这个不是插件,构建时指定一些文件打入jar包
3.命令
mvn test 运行测试
mvn compiler 运行编译
mvn package 打包
mvn install 打包并发布到本地仓库
mvn deploy 打包并发布到远程仓库,仓库配置:
<repository>
<id>public</id>
<name>public</name>
<url>http://10.10.10.10:8081/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>releases</id>
<name>releases</name>
<url>http://10.10.10.10:8081/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
mvn clean 清除运行文件
mvn eclipse:eclipse 转化为eclipse项目
mvn idea:idea 转化为idea项目
mvn test -compile 编译测试代码
mvn jetty:run jetty运行
maven可以进行很多拼接命令,比如
mvn clean compile install deploy -Dmaven.test.skip=true 这个命令就是先清除,再编译打包,发布到本地,发布到远程,并且跳过测试.
待续...
回顾:maven配置和常用命令整理的更多相关文章
- Tomcat性能优化及常用命令整理
1汤姆猫性能优化 1.1连接参数 1.1.1默认连接配置 默认连接器采用阻塞式 IO,默认最大线程数为200,配置如下: <Connector port="8080" pro ...
- 【linux】---常用命令整理
linux常用命令整理 一.ls命令 就是list的缩写,通过ls 命令不仅可以查看linux文件夹包含的文件,而且可以查看文件权限(包括目录.文件夹.文件权限)查看目录信息等等 常用参数搭配: l ...
- linux 服务器常用命令整理
linux 服务器常用命令整理 目录 网络分析 - tcpdump \ telnet \ (netstat \ ss \ lsof) \ nload 网络传输 - scp \ rsync \ (rz ...
- (小组)Git 常用命令整理
Git 常用命令整理 取得Git仓库 初始化一个版本仓库 git init Clone远程版本库 git clone git@xbc.me:wordpress.git 添加远程版本库origin,语法 ...
- salt 常用命令整理
salt 常用命令整理 ***********模块*********** 查看模块列表module salt 'minion' sys.list_modules 查看指定module的function ...
- (Linux环境Kafka集群安装配置及常用命令
Linux环境Kafka集群安装配置及常用命令 Kafka 消息队列内部实现原理 Kafka架构 一.下载Kafka安装包 二.Kafka安装包的解压 三.设置环境变量 四.配置kafka文件 4.1 ...
- Dos常用命令整理
Dos常用命令整理 打开cmd的方法 开始菜单 -> 系统 -> 命令提示符 组合键Win+R打开运行 -> 输入cmd 在任意文件夹下Shift+鼠标右键 -> 在此处打开命 ...
- Maven 插件 maven-tomcat7-plugin - 常用命令及配置
常用命令 tomcat7:deploy 说明:部署 WAR 到 Tomcat tomcat7:help 说明:查看插件帮助信息 tomcat7:run 说明:支行当前项目 配置 <project ...
- Git 配置环境及常用命令整理
一.Git教程网站 廖雪峰网站 易百GitHub命令:https://www.yiibai.com/git/git_clone.html 完成Windows环境命令下Git config配置 设置好之 ...
随机推荐
- Google Protocol Buffers介绍
简要介绍和总结protobuf的一些关键点,从我之前做的ppt里摘录而成,希望能节省protobuf初学者的入门时间.这是一个简单的Demo. Protobuf 简介 Protobuf全称Google ...
- win7 安装mysql 5.7.9记录
-------------------------------------------------------------------------- 1. 将配置文件my.ini配置好,放到c:/wi ...
- 关于ansbile工具的shell、command、script、raw模块的区别和使用场景
command模块 [执行远程命令] [root@node1 ansible]# ansible testservers -m command -a 'uname -n' script模块 [在远程主 ...
- PureFtpd 连接数据库错误
用Ubuntu一段时间了,作为服务器真是好用,还轻快的很. 作为服务器怎么能没有ftp呢,这里用了pureftpd,没有用vsftpd是因为听大牛说听麻烦,没用过没发言权,不过pureftpd真的挺好 ...
- [svc]Linux vmstat命令实战详解
vmstat输出 注:是cpu 内存 磁盘 虚拟内存交换情况 io读写情况 vmstat命令是最常见的Linux/Unix监控工具,可以展现给定时间间隔的服务器的状态值,包括服务器的CPU使用率,内存 ...
- 《Android源代码设计模式解析》读书笔记——Android中你应该知道的设计模式
断断续续的,<Android源代码设计模式解析>也看了一遍.书中提到了非常多的设计模式.可是有部分在开发中见到的几率非常小,所以掌握不了也没有太大影响. 我认为这本书的最大价值有两点,一个 ...
- async与await 实例
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- iOS9中怎样注冊远程通知
大熊猫猪·侯佩原创或翻译作品.欢迎转载,转载请注明出处. 假设认为写的不好请多提意见,假设认为不错请多多支持点赞.谢谢! hopy ;) 在以往的版本号中,我们能够通过: [[UIApplicatio ...
- Swift中Notification.Name这么难用怎么办
Swift中Notification.Name这么难用怎么办 以前的发送通知的参数就是一个简单的字符串: NSNotificationCenter.defaultCenter().post(" ...
- linux内核编译错误集锦
1,我是用的ubuntu16.04 32位系统编译内核linux-3.0.1出现如下错误:Can't use 'defined(@array)' (Maybe you should just omit ...