java - By default run gradle tests for project dependencies -
is there clean way run test task project java dependencies in gradle ? noticed java dependencies "jar" task run, , skip test / build.
main-code build.gradle
dependencies { compile project(":shared-code") }
gradle :main-code:build <-- command want run (that run :shared-code:tests , don't want explicitly state it)
:shared-code:compilejava up-to-date :shared-code:processresources up-to-date :shared-code:classes :shared-code:jar
<-- gets run shared-code (not missing build/tests)
** best thing can think of finalizeby task on jar test
upd: there task called buildneeded
buildneeded - assembles , tests project , projects depends on.
it build run tests of projects current project dependent on.
old answer: seems gradle doesn`t out-of-box (tested on version 2.14.1). came workaround. build task triggers evaluation of chain of other tasks include testing phase.
testwebserver/lib$ gradle build --daemon :testwebserver-lib:compilejava up-to-date :testwebserver-lib:processresources up-to-date :testwebserver-lib:classes up-to-date :testwebserver-lib:jar up-to-date :testwebserver-lib:assemble up-to-date :testwebserver-lib:compiletestjava up-to-date :testwebserver-lib:processtestresources up-to-date :testwebserver-lib:testclasses up-to-date :testwebserver-lib:test up-to-date :testwebserver-lib:check up-to-date :testwebserver-lib:build up-to-date
in order force testing of dependency project (testwebserver-lib) dependent project (testwebserver) added task dependency in testwebserver/build.gradle:
... compilejava.dependson ':testwebserver-lib:test' dependencies { compile project(':testwebserver-lib') } ...
Comments
Post a Comment