Gradle

Installation

Install in Windows 10 environment.

download

Download from the official website below https://gradle.org/releases/ Download the latest version 4.8.1 as of July 16, 2018.

Extract files and set environment variables

Expand to "D: \ gradle-4.8.1". Create the environment variable "GRADLE_HOME". Add "% GRADLE_HOME% \ bin" to your PATH. Exit when you can execute "gradle -version" at the command prompt.

How to use

Reference site: https://qiita.com/vvakame/items/83366fbfa47562fafbf4

Error handling

Error: This character cannot be mapped to encoding MS932

tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }

For JUnit 5

bild.gradle


plugins {
  id 'java'
}

repositories {
    mavenCentral()
}

test {
    useJUnitPlatform {
        includeEngines 'junit-jupiter'
    }
}

dependencies {
    testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.2.0'
	testCompile "commons-io:commons-io:2.6"
	testCompile "org.junit.jupiter:junit-jupiter-migrationsupport:5.2.0" 
    testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.2.0'
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

JUnit5 Refer to the following.

https://junit.org/junit5/docs/current/user-guide/ gradle -q test -PincTags=ABC

build.gradle


apply plugin: 'java'

repositories {
	mavenCentral()
}

dependencies {
	testCompile('org.junit.jupiter:junit-jupiter-api:5.2.0')
	testRuntime('org.junit.jupiter:junit-jupiter-engine:5.2.0')
	testCompile "commons-io:commons-io:2.6"
}

test {
    useJUnitPlatform{
        if (project.hasProperty('incTags')) {
	    includeTags incTags
        }
        if (project.hasProperty('excTags')) {
            excludeTags excTags
        }
    }

	testLogging {
		events "passed", "skipped", "failed"
	}

	reports {
		html.enabled = true
	}
}

task wrapper(type: Wrapper) {
	description = 'Generates gradlew[.bat] scripts'
	gradleVersion = '4.6'
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

Jenkins

Test not run

Add "clean test" and clean first to Task of gradle.

Recommended Posts

Gradle
Gradle Memorandum
Gradle installation
Gradle task definitions
Gradle Japanese translation
What is Gradle?
Integration Test with Gradle
Launch SonarQube from Gradle
gradle tasks Japanese translation
First gradle build (Java)
Install Gradle with ubuntu16.04
DataNucleus starting with Gradle
Jigsaw notes in Gradle
Use WebJars with Gradle
How to use Gradle
Get started with Gradle
Use jlink with gradle
Launch Gradle from Ant