学习笔记-[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 ...
随机推荐
- SQL语句与正则表达式
今儿个才知道SQL语句还可以搭配正则表达式作为查询条件,很是有用. REGEXP_LIKE(匹配)REGEXP_INSTR (包含)REGEXP_REPLACE(替换)REGEXP_SUBSTR(提取 ...
- Oracle归档已满的处理办法
SqlPlus: / as sysdba select * from V$FLASH_RECOVERY_AREA_USAGE; show parameter log_archive_dest; sho ...
- ###《High-level event recognition in unconstrained videos》
Author: Yu-Gang Jiang, Shih-Fu Chang 事件检测的目标就是自动识别给定视频序列中的感兴趣事件.进行视频事件检测通常很困难,特别是在网络中非限制的视频.在非限制情况下, ...
- Windows Forms(二)
导读 1.用VS创建一个Windows Forms程序 2.分析上面的程序 3.Mediator pattern(中介者模式) 4.卡UI怎么办——BackgroundWorker组件 用VS创建一个 ...
- HDU 1087 Super Jumping! Jumping! Jumping!(动态规划)
Super Jumping! Jumping! Jumping! Problem Description Nowadays, a kind of chess game called “Super Ju ...
- config spec
config_spec Rules for selecting versions of elements to appear in a view APPLICABILITY Product Comma ...
- 在Windows下基于libx264.a的Qt 4.8.2视频压缩
1.在用mingw 4.5.2编译x264后,生成libx264.a文件,将libx264.a和x264.h和x264_config.h拷贝到Qt工程中,将mingw/lib/libpthread.a ...
- PHPstrom 增加emmet插件
之前记得使用Eclipse的时候有一个插件叫 emmet 可以实现快速开发前端,简直就是前端开发秒杀神器: 输入对应的代码一个table键就搞定了一堆代码: 在emmet的官网上 看到其实是支持的PH ...
- QtSQL学习笔记(2)- 连接到数据库
要使用QSqlQuery或者QSqlQueryModel访问一个数据库,首先需要创建并打开一个或多个数据库连接(database connections). 一般地,数据库连接是根据连接名(conne ...
- jQuery.hhLRSlider 左右滚动图片插件
/** * jQuery.hhLRSlider 左右滚动图片插件 * User: huanhuan * QQ: 651471385 * Email: th.wanghuan@gmail.com ...