7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

build.gradle で junit に付いてくる hamcrest-core を使わずに hamcrest-all を利用する dependencies の書き方

7
Posted at

概要

JUnit 4.11 を依存ライブラリに加えると勝手に hamcrest-core が付いてきちゃうのだけど、 hamcrest-core じゃなくて hamcrest-all を使いたいという場合の dependencies の書き方をメモっておく。

build.gradle の記述例

apply plugin: 'java'

sourceCompatibility = 1.5
version = '1.0'

repositories {
    mavenCentral()
}

dependencies {
    testCompile (group: 'junit', name: 'junit', version: '4.11') {
        // これで hamcrest-core の依存を除外する
        exclude module: 'hamcrest-core'
    }

    // 改めて hamcrest-all の依存を追加する
    testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
}
7
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?