« Return to Thread: all dependencies in single jar

Re: all dependencies in single jar

by hdockter :: Rate this Message:

Reply to Author | View in Thread

Hi Szczepan,

On Jul 13, 2009, at 11:57 AM, szczepiq wrote:

> That's OK, no rush and enjoy your holidays!.
>
> I produce fat jar using the merging feature already. Though, I thought
> there was a simpler way and you showed it at Jazoon (but I might be
> wrong:).

There is no simpler way yet.

>
> Essentially, I use mergeGroup feature it is pretty cool as it allows
> the build to be more maintainable - I can use wildcards and merge
> several jars. The thing I'm missing a bit is excluding files when
> doing mergeGroup. The reason is that my jars all contain some
> readme.txt file inside. When I merge all jars then I have 5 readme.txt
> in the fat jar. I can work around it by using 'merge' feature but then
> I have to specify full names of the jar files which is something I
> don't like. OTOH instead of mergeGroup I could use merge feature, so
> long it supports wildcards for file selection.

Could you file a Jira for this?

We definitely want to make the whole Gradle Archive API more powerful  
before 1.0. One reason why we are limited at the moment is, that we  
delegate to the Ant Archive tasks. Unfortunately there is no Java  
library I'm aware of, that provides a nice high level API for creating  
archives. So we have to come up with our own.

> I think I'm missing the concept of 'fat jar' in Gradle. Many times
> when I worked on a library/console app I needed to stick all
> dependencies in single jar. It would be great if java plugin added
> extra task that could produce fat jar (or mavenized:
> jar-with-dependencies) out of the box.

It would be easy to provide such a fatJar task for the default jar  
task. This would be the framework way of doing things (like Maven does).

But it would be much cooler, if there were the pattern fat<JarName>  
which works for any jar that is related to source directories. To make  
this possible we need a richer abstraction for source directories  
which we plan to do for 0.8. If we have such source dir objects you  
could also define a jar like:

task mySrcJar {
    add srcDir // srcDir is not String but a rich object, which knows  
all of the srcDir including its classpath
    fat = true
}

This would work with any project layout, not just with single src root  
projects. And it would enable to provide a rule for a pattern like  
above.

Toolset over Framework rules :)

Could you file a Jira for fat Jar creation?

Thanks

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


>
> Thanks!
> Szczepan
>
> On Wed, Jul 8, 2009 at 5:43 PM, <mail@...> wrote:
>> Hi Szczepan,
>>
>> we are all on holidays. This is the only time I have access to the
>> Internet. I'm back in my office on Friday. In the Java plugin  
>> chapter,
>> section 'Adding archives', there is a subsection called 'merging'. If
>> this does help, I will be able to provide more information on Friday.
>>
>> Cheers,
>>
>> - Hans
>>
>> On Mon, 06 Jul 2009 14:53 +0200, "szczepiq" <szczepiq@...>  
>> wrote:
>>> Hi,
>>>
>>> It's going to be a quickie for you guys and to my excuse I did
>>> searched in manual for a while :)
>>>
>>> What's the easiest way to produce 'fat' jar, e.g. jar that has all  
>>> the
>>> dependencies inlined? I remember Hans showed it at Jazoon but I  
>>> forgot
>>> :)
>>>
>>> Thanks!
>>> Szczepan Faber
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>    http://xircles.codehaus.org/manage_email
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: all dependencies in single jar