1. 推荐两个库地址,开源中国的好像不好使了

    阿里的仓库: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配置和常用命令整理的更多相关文章

  1. Tomcat性能优化及常用命令整理

    1汤姆猫性能优化 1.1连接参数 1.1.1默认连接配置 默认连接器采用阻塞式 IO,默认最大线程数为200,配置如下: <Connector port="8080" pro ...

  2. 【linux】---常用命令整理

    linux常用命令整理 一.ls命令 就是list的缩写,通过ls 命令不仅可以查看linux文件夹包含的文件,而且可以查看文件权限(包括目录.文件夹.文件权限)查看目录信息等等 常用参数搭配: l ...

  3. linux 服务器常用命令整理

    linux 服务器常用命令整理 目录 网络分析 - tcpdump \ telnet \ (netstat \ ss \ lsof) \ nload 网络传输 - scp \ rsync \ (rz ...

  4. (小组)Git 常用命令整理

    Git 常用命令整理 取得Git仓库 初始化一个版本仓库 git init Clone远程版本库 git clone git@xbc.me:wordpress.git 添加远程版本库origin,语法 ...

  5. salt 常用命令整理

    salt 常用命令整理 ***********模块*********** 查看模块列表module salt 'minion' sys.list_modules 查看指定module的function ...

  6. (Linux环境Kafka集群安装配置及常用命令

    Linux环境Kafka集群安装配置及常用命令 Kafka 消息队列内部实现原理 Kafka架构 一.下载Kafka安装包 二.Kafka安装包的解压 三.设置环境变量 四.配置kafka文件 4.1 ...

  7. Dos常用命令整理

    Dos常用命令整理 打开cmd的方法 开始菜单 -> 系统 -> 命令提示符 组合键Win+R打开运行 -> 输入cmd 在任意文件夹下Shift+鼠标右键 -> 在此处打开命 ...

  8. Maven 插件 maven-tomcat7-plugin - 常用命令及配置

    常用命令 tomcat7:deploy 说明:部署 WAR 到 Tomcat tomcat7:help 说明:查看插件帮助信息 tomcat7:run 说明:支行当前项目 配置 <project ...

  9. Git 配置环境及常用命令整理

    一.Git教程网站 廖雪峰网站 易百GitHub命令:https://www.yiibai.com/git/git_clone.html 完成Windows环境命令下Git config配置 设置好之 ...

随机推荐

  1. python pandas replace函数

    在处理数据的时候,很多时候会遇到批量替换的情况,如果一个一个去修改效率过低,也容易出错.replace()是很好的方法. 1.基本结构: df.replace(to_replace, value) 前 ...

  2. C#基础第七天-作业-利用面向对象的思想去实现名片-动态添加

    1.利用面向对象的思想去实现: (增加,修改,删除,查询,查询全部)需求:根据人名去(删除/查询).指定列:姓名,年龄,性别,爱好,电话. 多条添加 , 动态添加 名片 本系列教程: C#基础总结之八 ...

  3. LogStash如何通过jdbc 从mysql导入elasticsearch

    input { stdin { } jdbc { # mysql jdbc connection string to our backup databse jdbc_connection_string ...

  4. haproxy 非常完整的配置

    常用配置选项: OPTION 选项: option httpclose :HAProxy会针对客户端的第一条请求的返回添加cookie并返回给客户端,客户端发送后续请求时会发送 此cookie到HAP ...

  5. 在 Windows 7 中安装 .NET Framework 时遇到错误:无法建立到信任根颁发机构的证书链

    当全新安装 Windows 7 SP1 后,在未安装任何补丁,也未进行联网的状态下,安装 .NET Framework 4.6 或更高的版本时,应该会遇到错误提示:无法建立到信任根颁发机构的证书链. ...

  6. 2012版辅助开发工具包(ADT)新功能特性介绍及安装使用

    原文链接:http://android.eoe.cn/topic/android_sdk 2012年的Android辅助设备开发工具包(ADK)是Android开放设备协议(AOA)设备的最新参考实现 ...

  7. oracle trim函数用法详解

    在oracle数据库中,trim一般都是用在删除字符串两边的空格.实际上,trim也可以用来删除字符串两边的指定字符.并且trim指定删除的字符串只能是单个字符Oracle TRIM函数是很常见的函数 ...

  8. ios开发-引导页实现

    源码:http://files.cnblogs.com/ios8/%5Bcode4app.com%5DIntroductionTutorialView_10843.zip 可以看看demo,很简单,我 ...

  9. vivado烧写bin文件到flash 中

    点击 bitstream setting ,将 bin_file 勾上,点击 OK. 2)点击 generate bitstream ,生成 bit 文件和 bin 文件 3)点击 open hard ...

  10. 88个 Linux 系统管理员必备的监控工具

    随着互联网行业的不断发展,各种监控工具多得不可胜数.这里列出网上最全的监控工具.让你可以拥有超过80种方式来管理你的机器.在本文中,我们主要包括以下方面: 命令行工具 网络相关内容 系统相关的监控工具 ...