Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How does test execution creates a dependency on clover tasks in gradle?

As per the instructions here: https://confluence.atlassian.com/clover/gradle-clover-plugin-317950477.html , integrating clover manually, one of the steps is:

test execution - add clover.jar to the test classpath

test {
    def cloverClasspath = configurations.testRuntime + configurations.cloverRuntime + sourceSets.test.output + sourceSets.clover.output
    classpath = cloverClasspath
}

How does this work? I have noticed, somehow adding the clover jar in test task's classpath, pulls in cloverInstr and compileCloverJava tasks.

1 answer

It most probably works because inferred task dependencies (https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:inferred_task_dependencies) in gradle.

Because `sourceSets.clover.output` is added to the classPath of the `test` task, gradle resolves it by adding a task dependency.

Generally speaking, Gradle can figure out task dependencies basing on task inputs/outputs.

Since test task depends on: 

* sourceSets.test.output

* sourceSets.clover.output

Gradle knows Test task is needs to invoke testClasses (testCompile + testProcessResources) and cloverClasses first because those are the tasks which generate output of a source set. 

As it goes about clover.jar. Configuration cloverRuntime contains it so test task classpath contains it as well. Nothing super fancy here ;)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Learn how to request and manage app requests in the Marketplace

G’day everyone! Super exciting news coming from the Marketplace. We have now fully rolled out the ability for end-users to submit app requests to admins directly from within the product! No longer ...

43 views 1 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you