maven常见命令

mvn clean
mvn compile
mvn package
mvn clean compile package
mvn -Djetty.port= jetty:run
mvn -Djetty.port= jetty:run
mvn clean compile -Djetty.port= jetty:run
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc 命令使用方法:
首先进入到相应的pom.xml目录中,然后执行以上命令:
第一个命令是尝试下载在pom.xml中依赖的文件的源代码。
第二个命令:是尝试下载对应的javadocs
但是有可能一些文件没有源代码或者javadocs

单元测试覆盖率

单元测试Cobertura

<!-- 单元测试覆盖率插件 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-</encoding>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>

单元测试代码编写完成,所有设置配制好后,在工程根目录运行“mvn cobertura:cobertura”Maven 就会对代码进行编译
编译完成之后,就会在项目中运行测试代码并输出测试报告结果到目录 project_base$\target\site\cobertura\index.html

目标指令                                作用解释
cobertura:check 检查最后一次标注(instrumentation) 正确与否
cobertura:clean 清理插件生产的中间及最终报告文件
cobertura:dump-datafile Cobertura 数据文件 dump 指令 , 不常用
cobertura:instrument 标注编译好的 javaclass 文件
cobertura:cobertura 标注、运行测试并产生 Cobertura 覆盖率报告

maven 插件

<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dfile.encoding=UTF-</argLine>
<!--打包时是否略过测试 -->
<!--<skip>true</skip> -->
<!--测试出现错误时是否忽略,如果为true,则会直接打包 -->
<!--<testFailureIgnore>true</testFailureIgnore> -->
</configuration>
<version>2.17</version>
</plugin>
<!--maven jetty 插件配置 -->
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1..v20140903</version>
<configuration>
<webApp>
<contextPath>${jetty.context}</contextPath>
</webApp>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port></port>
</connector>
</connectors>
<stopKey>jetty</stopKey>
<stopPort></stopPort>
</configuration>
</plugin>
</plugins>
</pluginManagement>

tomcat 插件

       <!-- tomcat6 插件-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>/wp</path>
<port></port>
<uriEncoding>UTF-</uriEncoding>
<url>http://localhost:8080/manager/html</url>
<server>tomcat6</server>
</configuration>
</plugin>
<!-- tomcat7 插件-->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<port></port>
<path>/mgr</path>
<uriEncoding>UTF-</uriEncoding>
<finalName>mgr</finalName>
<server>tomcat7</server>
</configuration>
</plugin> path 是访问应用的路径
port 是tomcat 的端口号
uriEncoding URL按UTF-8进行编码,这样就解决了中文参数乱码。
Server 指定tomcat名称。 命令 描述
tomcat:deploy 部署一个web war包
tomcat:reload 重新加载web war包
tomcat:start 启动tomcat
tomcat:stop 停止
tomcat:run 启动嵌入式tomcat ,并运行当前tomcat
tomcat:undeploy 停止一个war包项目

maven备忘的更多相关文章

  1. GIS部分理论知识备忘随笔

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.高斯克吕格投影带换算 某坐标的经度为112度,其投影的6度带和3度带 ...

  2. python序列,字典备忘

    初识python备忘: 序列:列表,字符串,元组len(d),d[id],del d[id],data in d函数:cmp(x,y),len(seq),list(seq)根据字符串创建列表,max( ...

  3. Vi命令备忘

    备忘 Ctrl+u:向文件首翻半屏: Ctrl+d:向文件尾翻半屏: Ctrl+f:向文件尾翻一屏: Ctrl+b:向文件首翻一屏: Esc:从编辑模式切换到命令模式: ZZ:命令模式下保存当前文件所 ...

  4. ExtJs4常用配置方法备忘

    viewport布局常用属性 new Ext.Viewport({ layout: "border", renderTo: Ext.getBody(), defaults: { b ...

  5. [备忘] Automatically reset Windows Update components

    这两天遇到Windows 10的更新问题,官方有一个小工具,可以用来修复Windows Update的问题,备忘如下 https://support.microsoft.com/en-us/kb/97 ...

  6. ECMAScript 5(ES5)中bind方法简介备忘

    一直以来对和this有关的东西模糊不清,譬如call.apply等等.这次看到一个和bind有关的笔试题,故记此文以备忘. bind和call以及apply一样,都是可以改变上下文的this指向的.不 ...

  7. MFC通过txt查找文件并进行复制-备忘

    MFC基于对话框的Demo txt中每行一个23位的卡号. 文件夹中包含以卡号命名的图像文件.(fpt或者bmp文件) 要求遍历文件夹,找到txt中卡号所对应的图像文件,并复制出来. VC6.0写的. ...

  8. php 相关模块备忘

    在安装php的时候,不管是编译安装: ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc -- ...

  9. 『备忘』HttpWebRequest 在 POST 提交时, 标头(Headers)丢失原因

    近来研究 HttpWebRequest —— 辅助类完成时,POST JSON数据 总会 丢失标头(Headers). HttpWebRequest POST JSON数据,分如下几步: > 将 ...

随机推荐

  1. 命令行web客户端与HTTP REST API调试工具

    1.命令行web客户端 curl wget httpie 2.优雅的REST API调试工具 insomnia postman

  2. .net core 2.0 mvc 初步学习

    mvc_study *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !impor ...

  3. Pi 实现VLC网络视频监控

    安装摄像头 将Pi的原装摄像头安装在pi上面 ssh连接pi 通过xshell或者putty等工具连接ssh 安装VLC $ sudo apt-get update $ sudo apt-get in ...

  4. GO学习笔记 - Go 只有一种循环结构—— for 循环。

    一,Go 只有一种循环结构—— for 循环. 官方教程:https://tour.go-zh.org/flowcontrol/1 Go 只有一种循环结构—— for 循环. 基本的 for 循环包含 ...

  5. order by 使用注意

    create table user ( id int primary key, name varchar(11) , depid int ); create table dept( id int pr ...

  6. A - 最少拦截系统 (最长上升子序列)

    点击打开链接 A - 最少拦截系统 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度. ...

  7. java中集合

    一. List集合:  一次只存储一个元素 1.常用的list集合是ArrayList (1)在创建这个集合的对象时, 需要指定这个集合存储的数据类型! 否则这个集合的数据是不安全的. (2)与数组的 ...

  8. iOS出现 _OBJC_CLASS_$_ZSHomeServiceDataElementGroupLargeImage", referenced from:以及linker command failed with exit code 1 (use -v to see invocation)的错误分析

    先说第一个问题 出现这样的错误我总结的原因有两个,我碰到过的: 1.文件重命名,在你创建文件的时候重名了 2.如果你是在一个类中又创建了一个或者多个类,那么你可能没有实现你写的类,也就是你只是@int ...

  9. [CISCO] 思科交换机基本配置

    思科交换机基本配置 交换机是局域网中最重要的设备,交换机是基于 MAC 来进行工作的.和路由器类似,交换 机也有 IOS,IOS 的基本使用方法是一样的.本章将简单介绍交换机的一些基本配置,以及交换 ...

  10. .NET Core容器化之多容器应用部署-使用Docker-Compose

    原文补充: -- docker-compose.ymlversion: ' services: mvc-web: container_name: mvc.web.compose build: . re ...