回顾: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配置 设置好之 ...
随机推荐
- phantomjs 的安装部署
下载地址http://phantomjs.org/download.htmlwget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs ...
- ssm redis 数据字典在J2EE中的多种应用与实现
数据字典在项目中是不可缺少的“基础设施”,关于数据字典如何设计如何实现,今天抽空讲一下吧 先看一下表设计: 通过自定义标签来实现页面的渲染: public class DataDictValueTag ...
- csc.exe已退出,代码为-532462766
我的surface pro4爆屏了 打电话给微软客服,那边说3,4天内给我回复 只能转移源码等资料到老电脑上,老电脑是神舟 精盾K480N I7D2,装的是WIN10预览版build 1625.rs2 ...
- 转:CentOS 6.x 挂载读写NTFS分区(fuse-ntfs-3g)
from: http://mtd527.blog.163.com/blog/static/222723720151208127898/ 运行环境:CentOS 6.6 x64版本 CentOS不像F ...
- 手机前端开发调试利器 – vConsole
我们在开发手机版网页的时候,常常会出现下面的情景: (1) 开发时,在自己电脑上运行得好好的,在手机上打开就挂了,但是手机上又看不到error log: (2) 上线后,某用户表示页面失灵,但我们自己 ...
- Spring Cloud Consul
1.2.0.RELEASE 该项目通过自动配置并绑定到Spring环境和其他Spring编程模型成语,为Spring Boot应用程序提供Consul集成.通过几个简单的注释,您可以快速启用和配置应用 ...
- 银联在线支付B2C UnionPay.NET
新春即将来临,首先给大家拜个早年,祝攻城狮们新年快乐.万事如意.合家欢乐.团团圆圆.幸福健康.来年更能大展宏图 实现各自的梦想! 同时预祝各大科技公司大佬们事业蒸蒸日上.公司转型突破创新.冲出突围带领 ...
- 每日英语:Welcome to the Global Middle-Class Surge
The mass uprisings this summer in Egypt, Turkey and Brazil are powerful reminders that the middle cl ...
- Java 编程下简介 Class 与类加载
即使有一个类并对它一无所知,但其实它本身就包含了许多信息,Java 在需要使用到某个类时才会将类加载,并在 JVM 中以一个 java.lang.Class 的实例存在.从 Calss 实例开始,可以 ...
- android使用POI读写word doc文件
目录 1 读word doc文件 1.1 通过WordExtractor读文件 1.2 通过HWPFDocument读文件 2 写word doc文件 Apache p ...