Quantcast
Channel: Gradle Forums - Latest posts
Viewing all articles
Browse latest Browse all 20335

Specify the order when a task depends on 2 other tasks

$
0
0

I’ve searched for a solution but could not really find an answer that would fit my needs.

I have a project that is split into 4 subprojects like so

  • main project
    – backend
    – frontend
    – shared code
    – shared resources

My backend builds a .jar file for deployment but it needs some files that are generated in the shared-resources and frontend subprojects.

So my frontend subproject generates some javascript files that we need in the jar of the backend
and the shared resources generates some css files that need to be in the jar of the backend too.

How do I make sure that that the backend module is build as last.

In my backend build.gradle I have the following task:

task resolveFrontendCode(type: Copy) {

    from "${project.rootDir}/frontend/dist"
    into "${project.buildDir}/resources/main/static/js"

    from "${project.rootDir}/shared-resources/src/main/webapp/css/build"
    into "${project.buildDir}/resources/main/static/css/build"

    from "${project.rootDir}/shared-resources/src/main/webapp/images"
    into "${project.buildDir}/resources/main/static/images"

    it.dependsOn 'buildClientSideCode'
}

compileJava.dependsOn(resolveFrontendCode)

this task will copy the generated files into the backend project but it seems that my other subprojects are build first.

the buildClientSideCode task that it dependsOn is both defined in frontend and shared-resources

I’m hoping someone could point me in the right direction. Gradle is rather new to me.


Viewing all articles
Browse latest Browse all 20335

Trending Articles