一、Maven project management and build automation tool, more and more developers use it to manage the project jar. This article describes how Eclipse installation, configuration and use Maven.(This article draws on the experience of Wu Di students, but most of the steps are different from his writing, I have personally been completed.)

二、test environment:win7 Ultimate + ADT-Eclipse

三、First you have to make sure that you have configured the JAVA environment, learning software must believe it will not be unfamiliar, the Internet can easily search for an installation article will not repeat them here.

四、MAVEN environment configuration:go to 官网 download mawen files,extract to the root directory of your expectations, and then configure the environment variables.

  Updates about the configuration:

  MAVEN_HOME: D:\apache-maven-3.3.1(I chose to unpack in the D drive)

  MAVEN: %MAVEN_HOME%\bin

  PATH:%MAVEN%;(Plus an additional note in the back of PATH;)

五、Open the console,input mvn -v

  

  The following interface proved successful installation.

六、Use "compile,test,package" to build the project

  1.First ,input

$mvn archettype:generate

Then it will download the file of maven.

After a while,Then it reminds you enter groupID and some data, you can fill in according to your own situation.i will give a example.

  groupId: com.company.app

  artifactId:my-app-simple

  version:1.0

  ...push enter to continue.

  last it says bilud success,and in your in the directory of C:/user/yourname you have created your own project.

  my-app-simple
  |-- pom.xml
    `-- src
    |-- main
    |   `-- java
    |       `-- com
    |           `-- mycompany
    |               `-- app
    |                   `-- App.java
    `-- test
       `-- java
          `-- com
                     `-- mycompany
                        `-- app
                            `-- AppTest.java

  2.input

$cd my-app-simple
$mvn compile

  push Enter

  3.test,input:

$mvn test

  

  4.package ,input:

  

$mvn package 

  Still show BUILD SUCCESS.

  Your maven project so far has been built.

七、eclipse maven plugin installed(if you already had,then jumped this step)

  You can goto the following blog and get a eclipse maven plugin.THERE,and you download the file with my baidu cloud share.                http://pan.baidu.com/s/1kTvdteJ

八、import the project you build.

  open you eclipse,and choose Import->Others->Maven->Existing Maven Projects .

THEN choose Properties->Java Build Path ->ADD library->Junit.

十、write your app.java and apptest.java

app.java:

package com.mycompany.app;

/**
* Hello world!
*
*/
public class App
{
public String sayApp() {
return "Hello WangHui_3012218097!";
} public static void main( String[] args )
{
App app = new App();
System.out.println( "Hello WangHui_3012218097!" );
}
}

apptest.java

package com.mycompany.app;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite; /**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
} /**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
} /**
* Rigourous Test :-)
*/
public void testApp()
{ App app = new com.mycompany.app.App();
assertEquals("Hello WangHui_3012218097!", app.sayApp() );
}
}

IN THE END

choose  Run as->Junit Test

and the result in there:

if your work have no problem ,then you have did it.

十一、Summary

  it's a good way to do the junit test,and under the maven we have a better enviroment to manager a team.so ,professional tool will make you effective.

Eclipse下对MAVEN进行junit软件测试的更多相关文章

  1. Eclipse下的Maven

    本文转载自:http://www.cnblogs.com/zlslch/p/5882567.html 当我们无法从本地仓库找到需要的构件的时候,就会从远程仓库下载构件至本地仓库.一般地,对于每个人来说 ...

  2. Eclipse下新建Maven项目、自动打依赖jar包

    当我们无法从本地仓库找到需要的构件的时候,就会从远程仓库下载构件至本地仓库.一般地,对于每个人来说,书房只有一个,但外面的书店有很多,类似第,对于Maven来说,每个用户只有一个本地仓库,但可以配置访 ...

  3. [Eclipse的Maven项目搭建,仅为测试Maven功能]如何在Eclipse下搭建Maven项目

    [Eclipse的Maven项目搭建,仅为测试Maven功能]如何在Eclipse下搭建Maven项目   你可能需要了解以下才能更好的阅读以下: 在 Windows 中配置Maven: http:/ ...

  4. eclipse下新建maven项目

    eclipse下新建maven项目 1.1下载maven安装包 进入Maven官网的下载页面:http://maven.apache.org/download.cgi,如下图所示:\ 选择当前最新版本 ...

  5. 5.Maven和Eclipse整合(两种方式进行插件的安装),Maven相关设置,Eclipse下创建Maven项目

     1  第一种方式是:在连网的情况下.通过在helpàInstall下安装. 新的地址是:http://download.eclipse.org/technology/m2e/releases 2 ...

  6. Eclipse下运行maven项目失败且Tomcat服务器也启动不了

    今天遇到一个神奇的问题,在eclipse中创建一个maven项目后,Run on server 时说服务器启动失败.我以为是Eclipse配置tomcat的问题.找了一大堆没找到想要的答案!!! 我还 ...

  7. eclipse下创建maven项目并部署到tomcat服务器(转)

    maven项目部署到服务器有很多方法,可以利用jetty-maven-plugin或者tomcat-maven-plugin,这属于maven的知识点. 通常开发中,需要将项目放在服务器上借助开发工具 ...

  8. Eclipse下面的Maven管理的SSH框架整合(Struts,Spring,Hibernate)

    搭建的环境:eclispe下面的maven web项目 Struts:    2.5.10 Spring:    4.3.8 Hibernate:   5.1.7 .Final MySQL:   5. ...

  9. Eclipse下,Maven+JRebel安装破解手记

    Java开发中,Maven已经是标配,使用JRebel能大大地提高工作效率,特别是在Web开发中,不用重启tomcat,大大地提高了工作效率. 1.前提条件 安装JDK 8 安装eclipse, ec ...

随机推荐

  1. MVC错误:查询的结果不能枚举多次

    应用程序中的服务器错误. 查询的结果不能枚举多次. 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: S ...

  2. dockerfile_nginx+PHP+mongo数据库_完美搭建

      基于dockerfile创建nginx+PHP+mongo数据库_完美搭建     第一步:   从git上:git clone http://git.oursdata.com/wangyue/d ...

  3. C#异步调用的应用实践浅谈

    C#异步调用的应用实践最经公司工作需要调用一个外部的webservice,同时要将传出的数据进行保存,以自己以前的习惯,就打算逐步操作,失败啊,完全没考虑过用户体验效果,在同事指点下,意识到使用C#异 ...

  4. 常用的高级sql查询

    1.根据主键id数组批量修改 void updateByIdArr(Integer[] idArr); <update id="updateByIdArr" paramete ...

  5. uoj#276. 【清华集训2016】汽水(分数规划+点分治)

    传送门 没想到点分治那一层-- 首先不难发现这是个分数规划,先把所有的边长减去\(k\),二分答案,设为\(mid\),就是要求路径平均值\(ans\in[-mid,mid]\) 先来考虑\(ans\ ...

  6. [Xcode 实际操作]二、视图与手势-(10)UITapGestureRecognizer手势之单击

    目录:[Swift]Xcode实际操作 本文将演示使用视图的手势功能,完成视图的交互操作. import UIKit class ViewController: UIViewController { ...

  7. [Xcode 实际操作]七、文件与数据-(24)真机使用无线网络调试应用程序

    目录:[Swift]Xcode实际操作 本文将演示如何通过无线网络,在真机上测试应用程序. 首先通过数据线,将移动设备和电脑连接, 然后点击顶部的[Window]窗口菜单, ->[Devices ...

  8. XHTML学习笔记 Part4:列表

    1. 空格 如果在两个单词中间放置几个连续的空格,默认情况下只会显示一个空格,这种情况成为空格折叠.同样,如果在源文档中开始一个新行,或者放置多个连续的空行,则这些新行将被忽略并被处理为一个空格.对制 ...

  9. 字符串匹配,KMP算法

    KMP的详解见:https://segmentfault.com/a/1190000008575379 主要难点在于Next数组的理解,KMP是不需要回溯的匹配算法. #include<iost ...

  10. IP服务-7-系统日志

    默认情况下.Cisco路由器和交换机并不在NVRAM (非易失性内存)中记录事件:工程师可以使用命令logging buffered改变设备的这一默认行为.并且还可以使用额外参数来设定日志缓存的大小. ...