0

I want to overwrite test task in gradle (I am using Gradle 4.3 version at this moment) to change the behavior of this task.

Specifically, I am using scoverage gradle plugin in a Scala project and I want to execute $ gradle test to call test task and testScoverage task, both at the same time.

I attached task test(overwrite: true) << { testScoverage } statement to the last of build.gradle file but I always get the same message:

gradle test

> Configure project :
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_clmw9wbi7768vkj4j7g7sy8v2.run(C:\Users\sergio_rodriguez\Repositorios\my-autodevops-poc\build.gradle:52)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

I pretend to generate coverage report in a single statement to be able to use Auto Devops Gitlab.

How can I do this?

My build.gradle file is as given below:

group 'org.microservices.architecture'
version '1.0-SNAPSHOT'

apply plugin: 'distribution'
apply plugin: 'scala'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.scoverage:gradle-scoverage:2.1.0'
    }
}

apply plugin: "org.scoverage"

repositories {
    mavenCentral()
}

ext {
    scalaVersion = '2.12'
    akkaVersion = '2.5.4'
    akkaHttVersion = '10.0.9'
}

dependencies {
    compile 'org.scala-lang:scala-library:' + scalaVersion + '.1'
    compile 'com.typesafe.akka:akka-actor_' + scalaVersion + ':' + akkaVersion
    compile 'com.typesafe.akka:akka-stream_' + scalaVersion + ':' + akkaVersion
    compile 'com.typesafe.akka:akka-http_' + scalaVersion + ':' + akkaHttVersion
    compile 'com.typesafe.akka:akka-http-spray-json_' + scalaVersion + ':' + akkaHttVersion
    compile 'ch.qos.logback:logback-classic:1.1.11'
    compile 'com.typesafe.akka:akka-slf4j_' + scalaVersion + ':' + akkaVersion
    compile 'com.typesafe.akka:akka-http-testkit_' + scalaVersion + ':' + akkaHttVersion
    scoverage 'org.scoverage:scalac-scoverage-plugin_2.12:1.3.1', 'org.scoverage:scalac-scoverage-runtime_2.12:1.3.1'
    testCompile 'junit:junit:4.12'
    testCompile 'org.scalatest:scalatest_' + scalaVersion + ':3.0.1'
    testCompile 'com.typesafe.akka:akka-http-testkit_' + scalaVersion + ':' + akkaHttVersion
}

sourceSets.main.scala.srcDir 'src/main/scala'
sourceSets.test.scala.srcDir 'src/test/scala'

task wrapper(type: Wrapper) {
    gradleVersion = '4.3'
}

task stage(dependsOn: ['installDist'])

task test(overwrite: true) << { testScoverage }
Sergio Rodríguez Calvo
  • 1,183
  • 2
  • 16
  • 32

0 Answers0