How to compile project only for one task

Hi,

So I have an android project with 2 projects that are only needed when lint runs. My question is how can I set the dependencies so that these 2 projects are only compiled for the lint(or check) task?

If I have this in build.gradle

dependencies{
    // Other depedencies
    compile project(":lint-lib")
}

It also packages these libraries during the assembleRelease or assembleDebug tasks.

Note that lint-lib requires the 2nd project from the 2 projects I mentioned above.