Extract non-java project dependency

Hi, I am relatively new to Gradle and I have on extracting a non-java project dependency:

I had a unit test project, which requires a non-java project and a java project.
Non-java project: pure html resource, using ‘base’ gradle plugin, will zip all things up in the build task
Java project: use for unit test’s code generation
Unit test project: Run unit test, which requires copy all the resource in non-java project and java project.

What I want to do is, in order to execute the unit test,

  1. if the non-java project/java project are checked out local, then use the zip/jar directly after build, extract them into the temp folder in the unit test project and test execution.
  2. if they are not checked out locally, get from maven repo (private repo), extract them and do the same as (1).

The task can be done for (2), however, for (1), the unit test resolved dependency are not able to show the non-java project, as a result, only the java project’s jar is extracted.

May I know any better way to do this?

Great thanks!

You could use Gradle’s composite build feature to include another local project. Eg: you could include a local build if a folder exists


if (file('../other-project').exists()) {
    includeBuild '../other-project'

Then you could refer to the other project via it’s GAV.

configurations {
dependencies {
   staticResources 'com.foo:other-project:1.0@zip'
task unzipStaticResources(type:Copy) {
   from zipTree(configurations.staticResources.singleFile) 
   into "$buildDir/staticResources" 
test.dependsOn unzipStaticResources

Gradle will then use the local project if it exists, or source from a repository otherwise