Build a Zip distribution for a Java (or JVM-based) library

Currently, the application plugin creates a distribution containing the runtime dependencies for the application, along with other supporting files. It would be nice to do the same thing for JVM-based libraries.

Implementation ideas

One approach would be to add a new ‘java-library’ plugin, which does something like:

  • Adds a ‘distZip’ task which packages up the jar and runtime dependencies of the library as a Zip. * Include the contents of ‘src/dist’ in the Zip, as the application plugin does.

Extra credit

Some ideas for building on this:

  • Generate a Tar distribution as well. * Shared configuration and tasks with the application plugin, by extracting a common ‘dist’ plugin out of the application plugin (this is an advanced move). * Allow the distributions to be published instead of the jar. This would need to mess with the generated pom.xml/ivy.xml to remove the dependency declarations for those dependencies that have been bundled in the distribution (this is an advanced move).

See also


I’d like to contribute to Gradle and building a zip distribution seems to be a good things to start. Is there anyone who is already working on this ? What is the best way to contribute ?


Git pull requests are the best way to contribute code. Have a read of our developer information.

If you need some help with getting started or have questions about how to work on Gradle, just ask on the dev mailing list (or here on the forums).


Thanks for your reply.

I have developped the implementation ideas and the two first Extra Credit. I share configuration and tasks with the application plugin so I have easily added a Tar task to the application plugin ( as suggested in this post : ).

I want to solve the last point and I need some informations before starting : - what does the pom.xml/ivy.xml contains ? - Which tasks generate these files ?

As this will be my first pull request on Gradle should I do a pull request for what I havec already done before going further ?


You should do a pull request for what you have already, and do the publishing as a separate piece of work.

The last point is actually quite tricky indeed, I think, in that it will need some changes to how we generate pom.xml and ivy.xml to work well. Would you mind raising the issue on the dev mailing list so we can discuss it there?

The link to the pull request : A link to the mail :