How to specify test task run by Gradle SonarQube plugin -
i using gradle sonarqube plugin , triggering using
gradle sonarqube however, calling built in "test" task runs types of tests including integration tests not pass @ moment. want able specify sonarqube task use "unittest" task instead of "test" task runs everything.
other people on team run cucumber tests within ide uses test task, when exclude cucumber tests in main "test" task, have comment excludes out in order cucumber tests kicked off, not ideal.
i including sonarqube using below syntax:
plugins { id "org.sonarqube" version "2.5" } how can make sonarqube task use test task?
update:
got work below code, made subprojects run unittests first generate required test report data , run sonarqube task.
// removes dependency on main test task , runs unittests test code coverage statistics tasks['sonarqube'].with { dependson.clear() subprojects.each { dependson("${it.name}:unittests") } } dependson.clear() clears dependencies, if there multiple, have
taskname.enabled=false and re-enable after task done unless there easier way it? i've tried dependson.remove("test") didn't work.
the sonarqube tasks depends on test task default, according the docs:
to meet these needs, plugins adds task dependency sonarqube on test if java plugin applied.
you can remove task dependency , add own ones:
task unittest { dolast { println "i'm unit test" } } tasks['sonarqube'].with { dependson.clear() dependson unittest } now, unittest task (and dependencies) executed whenever execute sonarqube task. please note, dependson list of dependency entries. can modify in many different ways.
Comments
Post a Comment