学习笔记-[Maven实战]-第三章:Maven使用入门(2)
使用maven执行编译和测试
1.maven执行编译
(1).在pom.xml上点右键,选择Maven build...
(2).在Goals里输入clean complie,执行编译
执行结果:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ helloworld ---
[INFO] Deleting D:\ProgramData\03work\helloworld\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ helloworld ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ProgramData\03work\helloworld\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ helloworld ---
[INFO] Compiling 1 source file to D:\ProgramData\03work\helloworld\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.047s
[INFO] Finished at: Tue Jul 16 17:50:51 CST 2013
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
2.Maven执行测试
(1).在pom.xml执行maven test,如图
执行结果
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ helloworld ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ProgramData\03work\helloworld\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ helloworld ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ helloworld ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\ProgramData\03work\helloworld\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ helloworld ---
[INFO] Compiling 1 source file to D:\ProgramData\03work\helloworld\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ helloworld ---
[INFO] Surefire report directory: D:\ProgramData\03work\helloworld\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.juvenxu.helloworld.AppTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.046 sec <<< FAILURE!
Results :
Failed tests: sayHello(com.juvenxu.helloworld.AppTest): expected:<hello[1]> but was:<hello[]>
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.750s
[INFO] Finished at: Tue Jul 16 17:53:20 CST 2013
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project helloworld: There are test failures.
[ERROR]
[ERROR] Please refer to D:\ProgramData\03work\helloworld\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
执行失败,因为类方法返回的是"hello",而我在测试类里写的是"hello1",所以失败了,修改一下测试代码就OK了
学习笔记-[Maven实战]-第三章:Maven使用入门(2)的更多相关文章
- 学习笔记-[Maven实战]-第三章:Maven使用入门(1)
说明:[Maven实战]一书还介绍了怎么样手工创建Maven工程,学习这本书是为了能尽快在工作中使用,就忽略了手工建工程的部分 如果想了解这部分的内容,可以自己看看书 开始: 1.新建一个maven工 ...
- 学习笔记-[Maven实战]-第三章:Maven使用入门(3)
这里说一下在建测试工程里遇到的问题 1.第一次建工程,junit依赖始终没有成功,最后删除现在工程,新建了一个工程就好了 2.使用junit4的问题.工程默认的依赖是junit3.8.1,我改成了4. ...
- 精读《C++ primer》学习笔记(第一至三章)
第一章: 重要知识点: 类型:一种类型不仅定义了数据元素的内容,还定义了这类数据上可以进行的运算:所以说类定义,实际上就是定义了一种数据类型: >>和<<运算符返回其左侧的运算 ...
- 深度学习Bible学习笔记:第二、三章 线性代数 概率与信息论
推荐资源: <线性代数的本质>:Essence of linear algebra 视频教程 <数学之美>(科普类书籍),吴军系列书籍都不错. 易向军<大嘴巴漫谈数据挖掘 ...
- Hadoop学习笔记(8) ——实战 做个倒排索引
Hadoop学习笔记(8) ——实战 做个倒排索引 倒排索引是文档检索系统中最常用数据结构.根据单词反过来查在文档中出现的频率,而不是根据文档来,所以称倒排索引(Inverted Index).结构如 ...
- DirectX 11游戏编程学习笔记之6: 第5章The Rendering Pipeline(渲染管线)
本文由哈利_蜘蛛侠原创,转载请注明出处.有问题欢迎联系2024958085@qq.com 注:我给的电子版是700多页,而实体书是800多页,所以我在提到相关概念的时候 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十二章:四元数(QUATERNIONS)
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第二十二章:四元数(QUATERNIONS) 学习目标 回顾复数,以及 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十九章:法线贴图
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十九章:法线贴图 学习目标 理解为什么需要法线贴图: 学习法线贴图如 ...
- Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十六章:实例化和截头锥体裁切
原文:Introduction to 3D Game Programming with DirectX 12 学习笔记之 --- 第十六章:实例化和截头锥体裁切 代码工程地址: https://git ...
随机推荐
- 40个Java集合面试问题和答案【上】【转载】
1.Java集合框架是什么?说出一些集合框架的优点? 每种编程语言中都有集合,最初的Java版本包含几种集合类:Vector.Stack.HashTable和Array.随着集合的广泛使用,Java1 ...
- CSS3的几个标签速记3
transition:CSS3过渡 css3里很好的一个标签,可以非常方便的完成需要很多JS才能完成的动态效果 例语法:transition:width 2S,height 2S,transf ...
- bzoj1015:[JSOI2008]星球大战starwar
思路:反着做用并查集维护连通块个数就好了. #include<iostream> #include<cstdio> #include<cstring> #inclu ...
- POJ 2127 Greatest Common Increasing Subsequence -- 动态规划
题目地址:http://poj.org/problem?id=2127 Description You are given two sequences of integer numbers. Writ ...
- java.util.regx Demo
import java.util.regex.Matcher;import java.util.regex.Pattern; public class TestRegex { public stati ...
- centos6.5 安装python2.7.5
1. 下载python2.7.5,保存到 /data/http://www.python.org/ftp/python/ 2. 解压文件tar xvf Python-2.7.5.tar.bz2 3. ...
- HTML5的离线储存
在用户没有与因特网连接时,可以正常访问站点或应用,在用户与因特网连接时,更新用户机器上的缓存文件. 原理:HTML5的离线存储是基于一个新建的.appcache文件的缓存机制(不是存储技 ...
- C#关于编码、解码相关问题
编码.解码技术是我们在程序中开发中经常使用到的,对一些敏感信息的存储,比如密码之类的,我们一般是不会直接以明文直接存储到数据库的,而是会通过各种算法,可以是现成的MD5(一种散列算法).或者是Hash ...
- webApi实现增删改查操作
1.WebApi是什么 ASP.NET Web API 是一种框架,用于轻松构建可以由多种客户端(包括浏览器和移动设备)访问的 HTTP 服务.ASP.NET Web API 是一种用于在 .NET ...
- 虚拟内存设备驱动memdev及实例代码
驱动: #include <linux/module.h> #include <linux/types.h> #include <linux/fs.h> #incl ...