简体   繁体   English

创建jar而不用gradle编译

[英]Create jar without compiling with gradle

I need to create several jars with different files in my project. 我需要在项目中使用不同的文件创建多个jar。 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. 我根本没有使用过Gradle,我一直在尝试了解这一点,但是我所看到的只是创建可执行jar的方法,我不想要那样。 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? 这会同时占用bin / org和bin / com下的文件吗? And, I don't think this creates a jar, does it? 而且,我不认为这会产生罐子,不是吗? How do I put it in a jar? 我怎么把它放在罐子里?

Thank you! 谢谢!

This will do the job: 这将完成工作:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM