Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle: How can I copy folder from another project in multi-project script?

I have a multi-project script:

dependencies {
    compile '...'
    ...

    compile project(':component1')
    runtime project(':component2')
}

I need to copy folder "bin" from component1 and component2 into folder "bin" of the current project.

UPDATE: I need this to be able to "Run as"->"Run on Server" in Eclipse. Each project has Java code and Web UI files, and depends on other projects in workspace. "Deployment Assembly" does not allow copying of compiled classes from another project.

like image 736
isobretatel Avatar asked Jan 15 '14 12:01

isobretatel


1 Answers

I don't understand you requirement to copy folders fully.

But here custom copy task:

task copyBin(type: Copy) {
    from project(':component1').file('bin')
    into file('bin')
}

And hook into your build process:

jar.dependsOn copyBin
like image 106
Eugen Martynov Avatar answered Nov 19 '22 02:11

Eugen Martynov