coconut
coconut

Reputation: 1101

Create jar without compiling with gradle

I need to create several jars with different files in my project. I haven't used Gradle at all, I've been trying to learn about this but all I can see is ways of creating executable jars, I don't want that. Just a jar with files.

I have written this:

task xmlbeansJar{
    sourceSets{
        main{
            java{
                srcDir '../bin'
                include "org/**/**, com/**/**"
            }
        }
    }
}

But I have some doubts. Does this take both, the files under bin/org and under bin/com? And, I don't think this creates a jar, does it? How do I put it in a jar?

Thank you!

Upvotes: 0

Views: 2274

Answers (1)

Tobias Otto
Tobias Otto

Reputation: 1676

This will do the job:

task xmlbeansJar(type: Jar, description: "creates a special jar"){
    from '../bin'
    include 'com/**'
    include 'org/**'
}

Upvotes: 2

Related Questions