junit和hamcrest声明 [英] junit and hamcrest declaration

查看:58
本文介绍了junit和hamcrest声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在4.10处使用junit,在1.3处声明hamcrest-core,在1.3处声明hamcrest-library.我的问题是在junit 4.10中嵌入的hamcrest库和hamcrest-core.那junit 4.11呢?

I am using junit at 4.10 and declared hamcrest-core at 1.3 and hamcrest-library at 1.3. My question is are hamcrest-library and hamcrest-core embedded in junit 4.10. what about junit 4.11?

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-core</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-library</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>

推荐答案

如果浏览到 search.maven.org ,则可以搜索工件并查看其依赖性.如果您通过Maven插件使用Eclipse,则还可以在POM编辑器中单击 Dependency Hierarchy .

If you browse to search.maven.org you can search for artifacts and see their dependencies. If you are using Eclipse wit the Maven plugin, you can also click Dependency Hierarchy in the POM editor.

Maven网站上,您可以看到JUnit 4.11依赖于Hamcrest 1.3:

Looking on the Maven website you can see that JUnit 4.11 depends on Hamcrest 1.3:

<dependencies>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
      <scope>compile</scope>
    </dependency>
</dependencies>

您必须添加自己的Hamcrest库.

Hamcrest library you have to add yourself.

这篇关于junit和hamcrest声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆